diff options
author | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
---|---|---|
committer | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
commit | 7c478bd95313f5f23a4c958a745db2134aa03244 (patch) | |
tree | c871e58545497667cbb4b0a4f2daf204743e1fe7 /usr/src/lib/libldap5/include | |
download | illumos-gate-7c478bd95313f5f23a4c958a745db2134aa03244.tar.gz |
OpenSolaris Launch
Diffstat (limited to 'usr/src/lib/libldap5/include')
-rw-r--r-- | usr/src/lib/libldap5/include/ldap/disptmpl.h | 376 | ||||
-rw-r--r-- | usr/src/lib/libldap5/include/ldap/ldaplog.h | 92 | ||||
-rw-r--r-- | usr/src/lib/libldap5/include/ldap/ldappr.h | 251 | ||||
-rw-r--r-- | usr/src/lib/libldap5/include/ldap/ldaprot.h | 211 | ||||
-rw-r--r-- | usr/src/lib/libldap5/include/ldap/ldif.h | 99 | ||||
-rw-r--r-- | usr/src/lib/libldap5/include/ldap/log.h | 59 | ||||
-rw-r--r-- | usr/src/lib/libldap5/include/ldap/portable.h | 430 | ||||
-rw-r--r-- | usr/src/lib/libldap5/include/ldap/sec.h | 14 | ||||
-rw-r--r-- | usr/src/lib/libldap5/include/ldap/solaris-int.h | 548 | ||||
-rw-r--r-- | usr/src/lib/libldap5/include/ldap/solaris-priv.h | 36 | ||||
-rw-r--r-- | usr/src/lib/libldap5/include/ldap/srchpref.h | 150 |
11 files changed, 2266 insertions, 0 deletions
diff --git a/usr/src/lib/libldap5/include/ldap/disptmpl.h b/usr/src/lib/libldap5/include/ldap/disptmpl.h new file mode 100644 index 0000000000..adc620e633 --- /dev/null +++ b/usr/src/lib/libldap5/include/ldap/disptmpl.h @@ -0,0 +1,376 @@ +/* + * Copyright (c) 2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998-1999 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* + * Copyright (c) 1993, 1994 Regents of the University of Michigan. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of Michigan at Ann Arbor. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + * + * disptmpl.h: display template library defines + */ + +#ifndef _DISPTMPL_H +#define _DISPTMPL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* calling conventions used by library */ +#ifndef LDAP_CALL +#if defined( _WINDOWS ) || defined( _WIN32 ) +#define LDAP_C __cdecl +#ifndef _WIN32 +#define __stdcall _far _pascal +#define LDAP_CALLBACK _loadds +#else +#define LDAP_CALLBACK +#endif /* _WIN32 */ +#define LDAP_PASCAL __stdcall +#define LDAP_CALL LDAP_PASCAL +#else /* _WINDOWS */ +#define LDAP_C +#define LDAP_CALLBACK +#define LDAP_PASCAL +#define LDAP_CALL +#endif /* _WINDOWS */ +#endif /* LDAP_CALL */ + +#ifndef _SOLARIS_SDK + +#define LDAP_TEMPLATE_VERSION 1 + +/* + * general types of items (confined to most significant byte) + */ +#define LDAP_SYN_TYPE_TEXT 0x01000000L +#define LDAP_SYN_TYPE_IMAGE 0x02000000L +#define LDAP_SYN_TYPE_BOOLEAN 0x04000000L +#define LDAP_SYN_TYPE_BUTTON 0x08000000L +#define LDAP_SYN_TYPE_ACTION 0x10000000L + + +/* + * syntax options (confined to second most significant byte) + */ +#define LDAP_SYN_OPT_DEFER 0x00010000L + + +/* + * display template item syntax ids (defined by common agreement) + * these are the valid values for the ti_syntaxid of the tmplitem + * struct (defined below). A general type is encoded in the + * most-significant 8 bits, and some options are encoded in the next + * 8 bits. The lower 16 bits are reserved for the distinct types. + */ +#define LDAP_SYN_CASEIGNORESTR ( 1 | LDAP_SYN_TYPE_TEXT ) +#define LDAP_SYN_MULTILINESTR ( 2 | LDAP_SYN_TYPE_TEXT ) +#define LDAP_SYN_DN ( 3 | LDAP_SYN_TYPE_TEXT ) +#define LDAP_SYN_BOOLEAN ( 4 | LDAP_SYN_TYPE_BOOLEAN ) +#define LDAP_SYN_JPEGIMAGE ( 5 | LDAP_SYN_TYPE_IMAGE ) +#define LDAP_SYN_JPEGBUTTON ( 6 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER ) +#define LDAP_SYN_FAXIMAGE ( 7 | LDAP_SYN_TYPE_IMAGE ) +#define LDAP_SYN_FAXBUTTON ( 8 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER ) +#define LDAP_SYN_AUDIOBUTTON ( 9 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER ) +#define LDAP_SYN_TIME ( 10 | LDAP_SYN_TYPE_TEXT ) +#define LDAP_SYN_DATE ( 11 | LDAP_SYN_TYPE_TEXT ) +#define LDAP_SYN_LABELEDURL ( 12 | LDAP_SYN_TYPE_TEXT ) +#define LDAP_SYN_SEARCHACTION ( 13 | LDAP_SYN_TYPE_ACTION ) +#define LDAP_SYN_LINKACTION ( 14 | LDAP_SYN_TYPE_ACTION ) +#define LDAP_SYN_ADDDNACTION ( 15 | LDAP_SYN_TYPE_ACTION ) +#define LDAP_SYN_VERIFYDNACTION ( 16 | LDAP_SYN_TYPE_ACTION ) +#define LDAP_SYN_RFC822ADDR ( 17 | LDAP_SYN_TYPE_TEXT ) + + +/* + * handy macros + */ +#define LDAP_GET_SYN_TYPE( syid ) ((syid) & 0xFF000000UL ) +#define LDAP_GET_SYN_OPTIONS( syid ) ((syid) & 0x00FF0000UL ) + + +/* + * display options for output routines (used by entry2text and friends) + */ +/* + * use calculated label width (based on length of longest label in + * template) instead of contant width + */ +#define LDAP_DISP_OPT_AUTOLABELWIDTH 0x00000001L +#define LDAP_DISP_OPT_HTMLBODYONLY 0x00000002L + +/* + * perform search actions (applies to ldap_entry2text_search only) + */ +#define LDAP_DISP_OPT_DOSEARCHACTIONS 0x00000002L + +/* + * include additional info. relevant to "non leaf" entries only + * used by ldap_entry2html and ldap_entry2html_search to include "Browse" + * and "Move Up" HREFs + */ +#define LDAP_DISP_OPT_NONLEAF 0x00000004L + +#endif /* ifndef _SOLARIS_SDK */ + +/* + * display template item options (may not apply to all types) + * if this bit is set in ti_options, it applies. + */ +#define LDAP_DITEM_OPT_READONLY 0x00000001L +#define LDAP_DITEM_OPT_SORTVALUES 0x00000002L +#define LDAP_DITEM_OPT_SINGLEVALUED 0x00000004L +#define LDAP_DITEM_OPT_HIDEIFEMPTY 0x00000008L +#define LDAP_DITEM_OPT_VALUEREQUIRED 0x00000010L +#define LDAP_DITEM_OPT_HIDEIFFALSE 0x00000020L /* booleans only */ + + +#ifndef _SOLARIS_SDK + +/* + * display template item structure + */ +struct ldap_tmplitem { + unsigned long ti_syntaxid; + unsigned long ti_options; + char *ti_attrname; + char *ti_label; + char **ti_args; + struct ldap_tmplitem *ti_next_in_row; + struct ldap_tmplitem *ti_next_in_col; + void *ti_appdata; +}; + +#define NULLTMPLITEM ((struct ldap_tmplitem *)0) + +#define LDAP_SET_TMPLITEM_APPDATA( ti, datap ) \ + (ti)->ti_appdata = (void *)(datap) + +#define LDAP_GET_TMPLITEM_APPDATA( ti, type ) \ + (type)((ti)->ti_appdata) + +#define LDAP_IS_TMPLITEM_OPTION_SET( ti, option ) \ + (((ti)->ti_options & option ) != 0 ) + + +/* + * object class array structure + */ +struct ldap_oclist { + char **oc_objclasses; + struct ldap_oclist *oc_next; +}; + +#define NULLOCLIST ((struct ldap_oclist *)0) + + +/* + * add defaults list + */ +struct ldap_adddeflist { + int ad_source; +#define LDAP_ADSRC_CONSTANTVALUE 1 +#define LDAP_ADSRC_ADDERSDN 2 + char *ad_attrname; + char *ad_value; + struct ldap_adddeflist *ad_next; +}; + +#define NULLADLIST ((struct ldap_adddeflist *)0) + + +/* + * display template global options + * if this bit is set in dt_options, it applies. + */ +/* + * users should be allowed to try to add objects of these entries + */ +#define LDAP_DTMPL_OPT_ADDABLE 0x00000001L + +/* + * users should be allowed to do "modify RDN" operation of these entries + */ +#define LDAP_DTMPL_OPT_ALLOWMODRDN 0x00000002L + +/* + * this template is an alternate view, not a primary view + */ +#define LDAP_DTMPL_OPT_ALTVIEW 0x00000004L + + +/* + * display template structure + */ +struct ldap_disptmpl { + char *dt_name; + char *dt_pluralname; + char *dt_iconname; + unsigned long dt_options; + char *dt_authattrname; + char *dt_defrdnattrname; + char *dt_defaddlocation; + struct ldap_oclist *dt_oclist; + struct ldap_adddeflist *dt_adddeflist; + struct ldap_tmplitem *dt_items; + void *dt_appdata; + struct ldap_disptmpl *dt_next; +}; + +#define NULLDISPTMPL ((struct ldap_disptmpl *)0) + +#define LDAP_SET_DISPTMPL_APPDATA( dt, datap ) \ + (dt)->dt_appdata = (void *)(datap) + +#define LDAP_GET_DISPTMPL_APPDATA( dt, type ) \ + (type)((dt)->dt_appdata) + +#define LDAP_IS_DISPTMPL_OPTION_SET( dt, option ) \ + (((dt)->dt_options & option ) != 0 ) + +#define LDAP_TMPL_ERR_VERSION 1 +#define LDAP_TMPL_ERR_MEM 2 +#define LDAP_TMPL_ERR_SYNTAX 3 +#define LDAP_TMPL_ERR_FILE 4 + +/* + * buffer size needed for entry2text and vals2text + */ +#define LDAP_DTMPL_BUFSIZ 8192 + +typedef int (*writeptype)( void *writeparm, char *p, int len ); + +LDAP_API(int) +LDAP_CALL +ldap_init_templates( char *file, struct ldap_disptmpl **tmpllistp ); + +LDAP_API(int) +LDAP_CALL +ldap_init_templates_buf( char *buf, long buflen, + struct ldap_disptmpl **tmpllistp ); + +LDAP_API(void) +LDAP_CALL +ldap_free_templates( struct ldap_disptmpl *tmpllist ); + +LDAP_API(struct ldap_disptmpl *) +LDAP_CALL +ldap_first_disptmpl( struct ldap_disptmpl *tmpllist ); + +LDAP_API(struct ldap_disptmpl *) +LDAP_CALL +ldap_next_disptmpl( struct ldap_disptmpl *tmpllist, + struct ldap_disptmpl *tmpl ); + +LDAP_API(struct ldap_disptmpl *) +LDAP_CALL +ldap_name2template( char *name, struct ldap_disptmpl *tmpllist ); + +LDAP_API(struct ldap_disptmpl *) +LDAP_CALL +ldap_oc2template( char **oclist, struct ldap_disptmpl *tmpllist ); + +LDAP_API(char **) +LDAP_CALL +ldap_tmplattrs( struct ldap_disptmpl *tmpl, char **includeattrs, int exclude, + unsigned long syntaxmask ); + +LDAP_API(struct ldap_tmplitem *) +LDAP_CALL +ldap_first_tmplrow( struct ldap_disptmpl *tmpl ); + +LDAP_API(struct ldap_tmplitem *) +LDAP_CALL +ldap_next_tmplrow( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row ); + +LDAP_API(struct ldap_tmplitem *) +LDAP_CALL +ldap_first_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row ); + +LDAP_API(struct ldap_tmplitem *) +LDAP_CALL +ldap_next_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row, + struct ldap_tmplitem *col ); + +LDAP_API(int) +LDAP_CALL +ldap_entry2text( LDAP *ld, char *buf, LDAPMessage *entry, + struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, + writeptype writeproc, void *writeparm, char *eol, int rdncount, + unsigned long opts ); + +LDAP_API(int) +LDAP_CALL +ldap_vals2text( LDAP *ld, char *buf, char **vals, char *label, int labelwidth, + unsigned long syntaxid, writeptype writeproc, void *writeparm, + char *eol, int rdncount ); + +LDAP_API(int) +LDAP_CALL +ldap_entry2text_search( LDAP *ld, char *dn, char *base, LDAPMessage *entry, + struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals, + writeptype writeproc, void *writeparm, char *eol, int rdncount, + unsigned long opts ); + +LDAP_API(int) +LDAP_CALL +ldap_entry2html( LDAP *ld, char *buf, LDAPMessage *entry, + struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, + writeptype writeproc, void *writeparm, char *eol, int rdncount, + unsigned long opts, char *urlprefix, char *base ); + +LDAP_API(int) +LDAP_CALL +ldap_vals2html( LDAP *ld, char *buf, char **vals, char *label, int labelwidth, + unsigned long syntaxid, writeptype writeproc, void *writeparm, + char *eol, int rdncount, char *urlprefix ); + +LDAP_API(int) +LDAP_CALL +ldap_entry2html_search( LDAP *ld, char *dn, char *base, LDAPMessage *entry, + struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals, + writeptype writeproc, void *writeparm, char *eol, int rdncount, + unsigned long opts, char *urlprefix ); + +#endif /* ifndef _SOLARIS_SDK */ + +LDAP_API(char *) +LDAP_CALL +ldap_tmplerr2string( int err ); + +#ifdef __cplusplus +} +#endif +#endif /* _DISPTMPL_H */ diff --git a/usr/src/lib/libldap5/include/ldap/ldaplog.h b/usr/src/lib/libldap5/include/ldap/ldaplog.h new file mode 100644 index 0000000000..5a5d3cf4a3 --- /dev/null +++ b/usr/src/lib/libldap5/include/ldap/ldaplog.h @@ -0,0 +1,92 @@ +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998-1999 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#ifndef _LDAPLOG_H +#define _LDAPLOG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDAP_DEBUG_TRACE 0x00001 +#define LDAP_DEBUG_PACKETS 0x00002 +#define LDAP_DEBUG_ARGS 0x00004 +#define LDAP_DEBUG_CONNS 0x00008 +#define LDAP_DEBUG_BER 0x00010 +#define LDAP_DEBUG_FILTER 0x00020 +#define LDAP_DEBUG_CONFIG 0x00040 +#define LDAP_DEBUG_ACL 0x00080 +#define LDAP_DEBUG_STATS 0x00100 +#define LDAP_DEBUG_STATS2 0x00200 +#define LDAP_DEBUG_SHELL 0x00400 +#define LDAP_DEBUG_PARSE 0x00800 +#define LDAP_DEBUG_HOUSE 0x01000 +#define LDAP_DEBUG_REPL 0x02000 +#define LDAP_DEBUG_ANY 0x04000 +#define LDAP_DEBUG_CACHE 0x08000 +#define LDAP_DEBUG_PLUGIN 0x10000 + +/* debugging stuff */ +/* Disable by default */ +#define LDAPDebug( level, fmt, arg1, arg2, arg3 ) + +#ifdef LDAP_DEBUG +# undef LDAPDebug + +/* SLAPD_LOGGING should not be on for WINSOCK (16-bit Windows) */ +# if defined(SLAPD_LOGGING) +# ifdef _WIN32 + extern int *module_ldap_debug; +# define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \ + { \ + if ( *module_ldap_debug & level ) { \ + slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \ + } \ + } +# else /* _WIN32 */ + extern int ldap_debug; +# define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \ + { \ + if ( ldap_debug & level ) { \ + slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \ + } \ + } +# endif /* Win32 */ +# else /* no SLAPD_LOGGING */ + extern void ber_err_print( char * ); + extern int ldap_debug; +# define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \ + if ( ldap_debug & level ) { \ + char msg[256]; \ + sprintf( msg, fmt, arg1, arg2, arg3 ); \ + ber_err_print( msg ); \ + } +# endif /* SLAPD_LOGGING */ +#endif /* LDAP_DEBUG */ + +#ifdef __cplusplus +} +#endif + +#endif /* _LDAP_H */ diff --git a/usr/src/lib/libldap5/include/ldap/ldappr.h b/usr/src/lib/libldap5/include/ldap/ldappr.h new file mode 100644 index 0000000000..99a981504e --- /dev/null +++ b/usr/src/lib/libldap5/include/ldap/ldappr.h @@ -0,0 +1,251 @@ +/* + * Copyright 2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998-1999 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#ifndef LDAP_PR_H +#define LDAP_PR_H + +#include "nspr.h" + +/* + * ldappr.h - prototypes for functions that tie libldap into NSPR (Netscape + * Portable Runtime). + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Function: prldap_init(). + * + * Create a new LDAP session handle, but with NSPR I/O, threading, and DNS + * functions installed. + * + * Pass a non-zero value for the 'shared' parameter if you plan to use + * this LDAP * handle from more than one thread. + * + * Returns an LDAP session handle (or NULL if an error occurs). + */ +LDAP * LDAP_CALL prldap_init( const char *defhost, int defport, int shared ); + + +/* + * Function: prldap_install_routines(). + * + * Install NSPR I/O, threading, and DNS functions so they will be used by + * 'ld'. + * + * If 'ld' is NULL, the functions are installed as the default functions + * for all new LDAP * handles). + * + * Pass a non-zero value for the 'shared' parameter if you plan to use + * this LDAP * handle from more than one thread. + * + * Returns an LDAP API error code (LDAP_SUCCESS if all goes well). + */ +int LDAP_CALL prldap_install_routines( LDAP *ld, int shared ); + + +#ifndef _SOLARIS_SDK /* Not used, left in to stay in sync with iplanet */ +/* + * Function: prldap_set_session_option(). + * + * Given an LDAP session handle or a session argument such is passed to + * CONNECT, POLL, NEWHANDLE, or DISPOSEHANDLE extended I/O callbacks, set + * an option that affects the prldap layer. + * + * If 'ld' and 'session" are both NULL, the option is set as the default + * for all new prldap sessions. + * + * Returns an LDAP API error code (LDAP_SUCCESS if all goes well). + */ +int LDAP_CALL prldap_set_session_option( LDAP *ld, void *sessionarg, + int option, ... ); + + +/* + * Function: prldap_get_session_option(). + * + * Given an LDAP session handle or a session argument such is passed to + * CONNECT, POLL, NEWHANDLE, or DISPOSEHANDLE extended I/O callbacks, retrieve + * the setting for an option that affects the prldap layer. + * + * If 'ld' and 'session" are both NULL, the default option value for all new + * new prldap sessions is retrieved. + * + * Returns an LDAP API error code (LDAP_SUCCESS if all goes well). + */ +int LDAP_CALL prldap_get_session_option( LDAP *ld, void *sessionarg, + int option, ... ); + + + +/* + * Available options. + */ +/* + * PRLDAP_OPT_IO_MAX_TIMEOUT: set the maximum time in milliseconds to + * block waiting for a network I/O operation to complete. + * + * Data type: int. + * + * These two special values from ldap-extension.h can also be used; + * + * LDAP_X_IO_TIMEOUT_NO_TIMEOUT + * LDAP_X_IO_TIMEOUT_NO_WAIT + */ +#define PRLDAP_OPT_IO_MAX_TIMEOUT 1 +#endif /* !_SOLARIS_SDK */ + + +/** + ** Note: the types and functions below are only useful for developers + ** who need to layer one or more custom extended I/O functions on top of + ** the standard NSPR I/O functions installed by a call to prldap_init() + ** or prldap_install_routines(). Layering can be accomplished after + ** prldap_init() or prldap_install_routines() has completed successfully + ** by: + ** + ** 1) Calling ldap_get_option( ..., LDAP_X_OPT_EXTIO_FN_PTRS, ... ). + ** + ** 2) Saving the function pointer of one or more of the standard functions. + ** + ** 3) Replacing one or more standard functions in the ldap_x_ext_io_fns + ** struct with new functions that optionally do some preliminary work, + ** call the standard function (via the function pointer saved in step 2), + ** and optionally do some followup work. + */ + +/* + * Data structure for session information. + * seinfo_size should be set to PRLDAP_SESSIONINFO_SIZE before use. + */ +struct prldap_session_private; + +typedef struct prldap_session_info { + int seinfo_size; + struct prldap_session_private *seinfo_appdata; +} PRLDAPSessionInfo; +#define PRLDAP_SESSIONINFO_SIZE sizeof( PRLDAPSessionInfo ) + + +/* + * Function: prldap_set_session_info(). + * + * Given an LDAP session handle or a session argument such is passed to + * CONNECT, POLL, NEWHANDLE, or DISPOSEHANDLE extended I/O callbacks, + * set some application-specific data. If ld is NULL, arg is used. If + * both ld and arg are NULL, LDAP_PARAM_ERROR is returned. + * + * Returns an LDAP API error code (LDAP_SUCCESS if all goes well). + */ +int LDAP_CALL prldap_set_session_info( LDAP *ld, void *sessionarg, + PRLDAPSessionInfo *seip ); + + +/* + * Function: prldap_get_session_info(). + * + * Given an LDAP session handle or a session argument such is passed to + * CONNECT, POLL, NEWHANDLE, or DISPOSEHANDLE extended I/O callbacks, + * retrieve some application-specific data. If ld is NULL, arg is used. If + * both ld and arg are NULL, LDAP_PARAM_ERROR is returned. + * + * Returns an LDAP API error code (LDAP_SUCCESS if all goes well, in + * which case the fields in the structure that seip points to are filled in). + */ +int LDAP_CALL prldap_get_session_info( LDAP *ld, void *sessionarg, + PRLDAPSessionInfo *seip ); + + +/* + * Data structure for socket specific information. + * Note: soinfo_size should be set to PRLDAP_SOCKETINFO_SIZE before use. + */ +struct prldap_socket_private; +typedef struct prldap_socket_info { + int soinfo_size; + PRFileDesc *soinfo_prfd; + struct prldap_socket_private *soinfo_appdata; +} PRLDAPSocketInfo; +#define PRLDAP_SOCKETINFO_SIZE sizeof( PRLDAPSocketInfo ) + + +/* + * Function: prldap_set_socket_info(). + * + * Given an integer fd and a socket argument such as those passed to the + * extended I/O callback functions, set socket specific information. + * + * Returns an LDAP API error code (LDAP_SUCCESS if all goes well). + * + * Note: it is only safe to change soinfo_prfd from within the SOCKET + * extended I/O callback function. + */ +int LDAP_CALL prldap_set_socket_info( int fd, void *socketarg, + PRLDAPSocketInfo *soip ); + +/* + * Function: prldap_get_socket_info(). + * + * Given an integer fd and a socket argument such as those passed to the + * extended I/O callback functions, retrieve socket specific information. + * + * Returns an LDAP API error code (LDAP_SUCCESS if all goes well, in + * which case the fields in the structure that soip points to are filled in). + */ +int LDAP_CALL prldap_get_socket_info( int fd, void *socketarg, + PRLDAPSocketInfo *soip ); + +/* + * Function: prldap_get_default_socket_info(). + * + * Given an LDAP session handle, retrieve socket specific information. + * If ld is NULL, LDAP_PARAM_ERROR is returned. + * + * Returns an LDAP API error code (LDAP_SUCCESS if all goes well, in + * which case the fields in the structure that soip points to are filled in). + */ +int LDAP_CALL prldap_get_default_socket_info( LDAP *ld, PRLDAPSocketInfo *soip ); + +/* + * Function: prldap_set_default_socket_info(). + * + * Given an LDAP session handle, set socket specific information. + * If ld is NULL, LDAP_PARAM_ERROR is returned. + * + * Returns an LDAP API error code (LDAP_SUCCESS if all goes well, in + * which case the fields in the structure that soip points to are filled in). + */ +int LDAP_CALL prldap_set_default_socket_info( LDAP *ld, PRLDAPSocketInfo *soip ); + +#ifdef __cplusplus +} +#endif +#endif /* !defined(LDAP_PR_H) */ diff --git a/usr/src/lib/libldap5/include/ldap/ldaprot.h b/usr/src/lib/libldap5/include/ldap/ldaprot.h new file mode 100644 index 0000000000..8fa7f37920 --- /dev/null +++ b/usr/src/lib/libldap5/include/ldap/ldaprot.h @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998-1999 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#ifndef _LDAPROT_H +#define _LDAPROT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDAP_VERSION1 1 +#define LDAP_VERSION2 2 +#define LDAP_VERSION3 3 +#define LDAP_VERSION LDAP_VERSION2 + +#define COMPAT20 +#define COMPAT30 +#if defined(COMPAT20) || defined(COMPAT30) +#define COMPAT +#endif + +#define LDAP_URL_PREFIX "ldap://" +#define LDAP_URL_PREFIX_LEN 7 +#define LDAPS_URL_PREFIX "ldaps://" +#define LDAPS_URL_PREFIX_LEN 8 +#define LDAP_REF_STR "Referral:\n" +#define LDAP_REF_STR_LEN 10 + +/* + * specific LDAP instantiations of BER types we know about + */ + +#ifdef _SOLARIS_SDK +#define LDAP_TAG_LDAPDN 0x04 /* OCTET STRING */ +#define OLD_LDAP_TAG_MESSAGE 0x10 /* forgot the constructed bit */ +#define LDAP_TAG_MRA_OID 0x81 /* context specific + primitive + 1 */ +#define LDAP_TAG_MRA_TYPE 0x82 /* context specific + primitive + 2 */ +#define LDAP_TAG_MRA_VALUE 0x83 /* context specific + primitive + 3 */ +#define LDAP_TAG_MRA_DNATTRS 0x84 /* context specific + primitive + 4 */ +#define LDAP_TAG_EXOP_REQ_OID 0x80 /* context specific + primitive + 0 */ +#define LDAP_TAG_EXOP_REQ_VALUE 0x81 /* context specific + primitive + 1 */ +#define LDAP_TAG_EXOP_RES_OID 0x8a /* context specific + primitive + 10 */ +#define LDAP_TAG_EXOP_RES_VALUE 0x8b /* context specific + primitive + 11 */ +#endif /* ifdef _SOLARIS_SDK */ + +#ifndef _SOLARIS_SDK + +/* general stuff */ +#define LDAP_TAG_MESSAGE 0x30L /* tag is 16 + constructed bit */ +#define LDAP_TAG_MSGID 0x02L /* INTEGER */ +#define LDAP_TAG_CONTROLS 0xa0L /* context specific + constructed + 0 */ +#define LDAP_TAG_REFERRAL 0xa3L /* context specific + constructed + 3 */ +#define LDAP_TAG_NEWSUPERIOR 0x80L /* context specific + primitive + 0 */ +#define LDAP_TAG_SASL_RES_CREDS 0x87L /* context specific + primitive + 7 */ +#define LDAP_TAG_VLV_BY_INDEX 0xa0L /* context specific + constructed + 0 */ +#define LDAP_TAG_VLV_BY_VALUE 0x81L /* context specific + primitive + 1 */ + + +#define LDAP_TAG_LDAPDN 0x04L /* OCTET STRING */ +#define OLD_LDAP_TAG_MESSAGE 0x10L /* forgot the constructed bit */ +#define LDAP_TAG_MRA_OID 0x81L /* context specific + primitive + 1 */ +#define LDAP_TAG_MRA_TYPE 0x82L /* context specific + primitive + 2 */ +#define LDAP_TAG_MRA_VALUE 0x83L /* context specific + primitive + 3 */ +#define LDAP_TAG_MRA_DNATTRS 0x84L /* context specific + primitive + 4 */ +#define LDAP_TAG_EXOP_REQ_OID 0x80L /* context specific + primitive + 0 */ +#define LDAP_TAG_EXOP_REQ_VALUE 0x81L /* context specific + primitive + 1 */ +#define LDAP_TAG_EXOP_RES_OID 0x8aL /* context specific + primitive + 10 */ +#define LDAP_TAG_EXOP_RES_VALUE 0x8bL /* context specific + primitive + 11 */ +#define LDAP_TAG_SK_MATCHRULE 0x80L /* context specific + primitive + 0 */ +#define LDAP_TAG_SK_REVERSE 0x81L /* context specific + primitive + 1 */ +#define LDAP_TAG_SR_ATTRTYPE 0x80L /* context specific + primitive + 0 */ + +/* possible operations a client can invoke */ +#define LDAP_REQ_BIND 0x60L /* application + constructed + 0 */ +#define LDAP_REQ_UNBIND 0x42L /* application + primitive + 2 */ +#define LDAP_REQ_SEARCH 0x63L /* application + constructed + 3 */ +#define LDAP_REQ_MODIFY 0x66L /* application + constructed + 6 */ +#define LDAP_REQ_ADD 0x68L /* application + constructed + 8 */ +#define LDAP_REQ_DELETE 0x4aL /* application + primitive + 10 */ +#define LDAP_REQ_MODRDN 0x6cL /* application + constructed + 12 */ +#define LDAP_REQ_MODDN 0x6cL /* application + constructed + 12 */ +#define LDAP_REQ_RENAME 0x6cL /* application + constructed + 12 */ +#define LDAP_REQ_COMPARE 0x6eL /* application + constructed + 14 */ +#define LDAP_REQ_ABANDON 0x50L /* application + primitive + 16 */ +#define LDAP_REQ_EXTENDED 0x77L /* application + constructed + 23 */ + +/* U-M LDAP release 3.0 compatibility stuff */ +#define LDAP_REQ_UNBIND_30 0x62L +#define LDAP_REQ_DELETE_30 0x6aL +#define LDAP_REQ_ABANDON_30 0x70L + +/* U-M LDAP 3.0 compatibility auth methods */ +#define LDAP_AUTH_SIMPLE_30 0xa0L /* context specific + constructed */ +#define LDAP_AUTH_KRBV41_30 0xa1L /* context specific + constructed */ +#define LDAP_AUTH_KRBV42_30 0xa2L /* context specific + constructed */ + +/* + * old broken stuff for backwards compatibility - forgot application tag + * and constructed/primitive bit + */ +#define OLD_LDAP_REQ_BIND 0x00L +#define OLD_LDAP_REQ_UNBIND 0x02L +#define OLD_LDAP_REQ_SEARCH 0x03L +#define OLD_LDAP_REQ_MODIFY 0x06L +#define OLD_LDAP_REQ_ADD 0x08L +#define OLD_LDAP_REQ_DELETE 0x0aL +#define OLD_LDAP_REQ_MODRDN 0x0cL +#define OLD_LDAP_REQ_MODDN 0x0cL +#define OLD_LDAP_REQ_COMPARE 0x0eL +#define OLD_LDAP_REQ_ABANDON 0x10L + +/* old broken stuff for backwards compatibility */ +#define OLD_LDAP_RES_BIND 0x01L +#define OLD_LDAP_RES_SEARCH_ENTRY 0x04L +#define OLD_LDAP_RES_SEARCH_RESULT 0x05L +#define OLD_LDAP_RES_MODIFY 0x07L +#define OLD_LDAP_RES_ADD 0x09L +#define OLD_LDAP_RES_DELETE 0x0bL +#define OLD_LDAP_RES_MODRDN 0x0dL +#define OLD_LDAP_RES_MODDN 0x0dL +#define OLD_LDAP_RES_COMPARE 0x0fL + +/* U-M LDAP 3.0 compatibility auth methods */ +#define LDAP_AUTH_SIMPLE_30 0xa0L /* context specific + constructed */ +#define LDAP_AUTH_KRBV41_30 0xa1L /* context specific + constructed */ +#define LDAP_AUTH_KRBV42_30 0xa2L /* context specific + constructed */ + +/* old broken stuff */ +#define OLD_LDAP_AUTH_SIMPLE 0x00L +#define OLD_LDAP_AUTH_KRBV4 0x01L +#define OLD_LDAP_AUTH_KRBV42 0x02L + +/* U-M LDAP 3.0 compatibility filter types */ +#define LDAP_FILTER_PRESENT_30 0xa7L /* context specific + constructed */ + +/* filter types */ +#define LDAP_FILTER_AND 0xa0L /* context specific + constructed + 0 */ +#define LDAP_FILTER_OR 0xa1L /* context specific + constructed + 1 */ +#define LDAP_FILTER_NOT 0xa2L /* context specific + constructed + 2 */ +#define LDAP_FILTER_EQUALITY 0xa3L /* context specific + constructed + 3 */ +#define LDAP_FILTER_SUBSTRINGS 0xa4L /* context specific + constructed + 4 */ +#define LDAP_FILTER_GE 0xa5L /* context specific + constructed + 5 */ +#define LDAP_FILTER_LE 0xa6L /* context specific + constructed + 6 */ +#define LDAP_FILTER_PRESENT 0x87L /* context specific + primitive + 7 */ +#define LDAP_FILTER_APPROX 0xa8L /* context specific + constructed + 8 */ +#define LDAP_FILTER_EXTENDED 0xa9L /* context specific + constructed + 0 */ + +/* old broken stuff */ +#define OLD_LDAP_FILTER_AND 0x00L +#define OLD_LDAP_FILTER_OR 0x01L +#define OLD_LDAP_FILTER_NOT 0x02L +#define OLD_LDAP_FILTER_EQUALITY 0x03L +#define OLD_LDAP_FILTER_SUBSTRINGS 0x04L +#define OLD_LDAP_FILTER_GE 0x05L +#define OLD_LDAP_FILTER_LE 0x06L +#define OLD_LDAP_FILTER_PRESENT 0x07L +#define OLD_LDAP_FILTER_APPROX 0x08L + +/* substring filter component types */ +#define LDAP_SUBSTRING_INITIAL 0x80L /* context specific + primitive + 0 */ +#define LDAP_SUBSTRING_ANY 0x81L /* context specific + primitive + 1 */ +#define LDAP_SUBSTRING_FINAL 0x82L /* context specific + primitive + 2 */ + +/* extended filter component types */ +#define LDAP_FILTER_EXTENDED_OID 0x81L /* context spec. + prim. + 1 */ +#define LDAP_FILTER_EXTENDED_TYPE 0x82L /* context spec. + prim. + 2 */ +#define LDAP_FILTER_EXTENDED_VALUE 0x83L /* context spec. + prim. + 3 */ +#define LDAP_FILTER_EXTENDED_DNATTRS 0x84L /* context spec. + prim. + 4 */ + +/* U-M LDAP 3.0 compatibility substring filter component types */ +#define LDAP_SUBSTRING_INITIAL_30 0xa0L /* context specific */ +#define LDAP_SUBSTRING_ANY_30 0xa1L /* context specific */ +#define LDAP_SUBSTRING_FINAL_30 0xa2L /* context specific */ + +/* old broken stuff */ +#define OLD_LDAP_SUBSTRING_INITIAL 0x00L +#define OLD_LDAP_SUBSTRING_ANY 0x01L +#define OLD_LDAP_SUBSTRING_FINAL 0x02L + +#endif /* _SOLARIS_SDK */ + +#ifdef __cplusplus +} +#endif +#endif /* _LDAPROT_H */ diff --git a/usr/src/lib/libldap5/include/ldap/ldif.h b/usr/src/lib/libldap5/include/ldap/ldif.h new file mode 100644 index 0000000000..c47554c1ac --- /dev/null +++ b/usr/src/lib/libldap5/include/ldap/ldif.h @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998-1999 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* + * Copyright (c) 1996 Regents of the University of Michigan. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of Michigan at Ann Arbor. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +#ifndef _LDIF_H +#define _LDIF_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDIF_VERSION_ONE 1 /* LDIF standard version */ + +#define LDIF_MAX_LINE_WIDTH 76 /* maximum length of LDIF lines */ + +/* + * Macro to calculate maximum number of bytes that the base64 equivalent + * of an item that is "vlen" bytes long will take up. Base64 encoding + * uses one byte for every six bits in the value plus up to two pad bytes. + */ +#define LDIF_BASE64_LEN(vlen) (((vlen) * 4 / 3 ) + 3) + +/* + * Macro to calculate maximum size that an LDIF-encoded type (length + * tlen) and value (length vlen) will take up: room for type + ":: " + + * first newline + base64 value + continued lines. Each continued line + * needs room for a newline and a leading space character. + */ +#define LDIF_SIZE_NEEDED(tlen,vlen) \ + ((tlen) + 4 + LDIF_BASE64_LEN(vlen) \ + + ((LDIF_BASE64_LEN(vlen) + tlen + 3) / LDIF_MAX_LINE_WIDTH * 2 )) + +/* + * Options for ldif_put_type_and_value_with_options() and + * ldif_type_and_value_with_options(). + */ +#define LDIF_OPT_NOWRAP 0x01UL +#define LDIF_OPT_VALUE_IS_URL 0x02UL +#define LDIF_OPT_MINIMAL_ENCODING 0x04UL + +int str_parse_line( char *line, char **type, char **value, int *vlen); +char * str_getline( char **next ); +void ldif_put_type_and_value( char **out, char *t, char *val, int vlen ); +void ldif_put_type_and_value_nowrap( char **out, char *t, char *val, int vlen ); +void ldif_put_type_and_value_with_options( char **out, char *t, char *val, + int vlen, unsigned long options ); +char *ldif_type_and_value( char *type, char *val, int vlen ); +char *ldif_type_and_value_nowrap( char *type, char *val, int vlen ); +char *ldif_type_and_value_with_options( char *type, char *val, int vlen, + unsigned long options ); +int ldif_base64_decode( char *src, unsigned char *dst ); +int ldif_base64_encode( unsigned char *src, char *dst, int srclen, + int lenused ); +int ldif_base64_encode_nowrap( unsigned char *src, char *dst, int srclen, + int lenused ); +char *ldif_get_entry( FILE *fp, int *lineno ); + +#ifdef __cplusplus +} +#endif + +#endif /* _LDIF_H */ diff --git a/usr/src/lib/libldap5/include/ldap/log.h b/usr/src/lib/libldap5/include/ldap/log.h new file mode 100644 index 0000000000..4cd45820f2 --- /dev/null +++ b/usr/src/lib/libldap5/include/ldap/log.h @@ -0,0 +1,59 @@ +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _LLOG_H +#define _LLOG_H + + +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <nl_types.h> +#include <limits.h> +#include <syslog.h> +#include <portable.h> + + + +/* Log levels */ + +/* slapd values */ +#define LDAP_DEBUG_TRACE 0x001 +#define LDAP_DEBUG_PACKETS 0x002 +#define LDAP_DEBUG_ARGS 0x004 +#define LDAP_DEBUG_CONNS 0x008 +#define LDAP_DEBUG_BER 0x010 +#define LDAP_DEBUG_FILTER 0x020 +#define LDAP_DEBUG_CONFIG 0x040 +#define LDAP_DEBUG_ACL 0x080 +#define LDAP_DEBUG_STATS 0x100 +#define LDAP_DEBUG_STATS2 0x200 +#define LDAP_DEBUG_SHELL 0x400 +#define LDAP_DEBUG_PARSE 0x800 +/* More values for http gateway */ +#define LDAP_DEBUG_GWAY 0x1000 +#define LDAP_DEBUG_GWAYMORE 0x2000 +/* Generic values */ +#define LDAP_DEBUG_ANY 0xffff + +nl_catd sundscat; +extern nl_catd slapdcat; +extern void ldaplogconfig(char * logf, int size); +extern void ldaplogconfigf(FILE *fd); +extern void ldaploginit(char *name, + int facility); +extern void ldaploginitlevel(char *name, + int facility, + int log_level); +extern void ldaplog(int level,char *fmt,...); + +#define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) \ +{ \ + if ( log_debug & level ) \ + fprintf( stderr, fmt, connid, opid, arg1, arg2, arg3 );\ + if ( log_syslog & level ) \ + ldaplog( level, fmt, connid, opid, arg1, arg2, arg3 ); \ +} +#endif /* _LLOG_H */ + + + diff --git a/usr/src/lib/libldap5/include/ldap/portable.h b/usr/src/lib/libldap5/include/ldap/portable.h new file mode 100644 index 0000000000..6b185077f6 --- /dev/null +++ b/usr/src/lib/libldap5/include/ldap/portable.h @@ -0,0 +1,430 @@ +/* + * Copyright (c) 2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998-1999 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* + * Copyright (c) 1994 Regents of the University of Michigan. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of Michigan at Ann Arbor. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +#ifndef _PORTABLE_H +#define _PORTABLE_H + +/* + * portable.h for LDAP -- this is where we define common stuff to make + * life easier on various Unix systems. + * + * Unless you are porting LDAP to a new platform, you should not need to + * edit this file. + */ + +#ifndef SYSV +#if defined( hpux ) || defined( sunos5 ) || defined ( sgi ) || defined( SVR4 ) +#define SYSV +#endif +#endif + +/* + * under System V, use sysconf() instead of getdtablesize + */ +#if !defined( USE_SYSCONF ) && defined( SYSV ) +#define USE_SYSCONF +#endif + +/* + * under System V, daemons should use setsid() instead of detaching from their + * tty themselves + */ +#if !defined( USE_SETSID ) && defined( SYSV ) +#define USE_SETSID +#endif + +/* + * System V has socket options in filio.h + */ +#if !defined( NEED_FILIO ) && defined( SYSV ) && !defined( hpux ) && !defined( AIX ) +#define NEED_FILIO +#endif + +/* + * use lockf() under System V + */ +#if !defined( USE_LOCKF ) && ( defined( SYSV ) || defined( aix )) +#define USE_LOCKF +#endif + +/* + * on many systems, we should use waitpid() instead of waitN() + */ +#if !defined( USE_WAITPID ) && ( defined( SYSV ) || defined( sunos4 ) || defined( ultrix ) || defined( aix )) +#define USE_WAITPID +#endif + +/* + * define the wait status argument type + */ +#if ( defined( SunOS ) && SunOS < 40 ) || defined( nextstep ) +#define WAITSTATUSTYPE union wait +#else +#define WAITSTATUSTYPE int +#endif + +/* + * define the flags for wait + */ +#ifdef sunos5 +#define WAIT_FLAGS ( WNOHANG | WUNTRACED | WCONTINUED ) +#else +#define WAIT_FLAGS ( WNOHANG | WUNTRACED ) +#endif + +/* + * defined the options for openlog (syslog) + */ +#ifdef ultrix +#define OPENLOG_OPTIONS LOG_PID +#else +#define OPENLOG_OPTIONS ( LOG_PID | LOG_NOWAIT ) +#endif + +/* + * some systems don't have the BSD re_comp and re_exec routines + */ +#ifndef NEED_BSDREGEX +#if ( defined( SYSV ) || defined( VMS ) || defined( netbsd ) || defined( freebsd ) || defined( linux )) && !defined(sgi) +#define NEED_BSDREGEX +#endif +#endif + +/* + * many systems do not have the setpwfile() library routine... we just + * enable use for those systems we know have it. + */ +#ifndef HAVE_SETPWFILE +#if defined( sunos4 ) || defined( ultrix ) || defined( OSF1 ) +#define HAVE_SETPWFILE +#endif +#endif + +/* + * Are sys_errlist and sys_nerr declared in stdio.h? + */ +#ifndef SYSERRLIST_IN_STDIO +#if defined( freebsd ) +#define SYSERRLIST_IN_STDIO +#endif +#endif + + +/* + * Is snprintf() part of the standard C runtime library? + */ +#if !defined(HAVE_SNPRINTF) +#if defined(SOLARIS) || defined(LINUX) || defined(HPUX) +#define HAVE_SNPRINTF +#endif +#endif + + +/* + * Async IO. Use a non blocking implementation of connect() and + * dns functions + */ +#if !defined(LDAP_ASYNC_IO) +#if !defined(_WINDOWS) && !defined(macintosh) +#define LDAP_ASYNC_IO +#endif /* _WINDOWS */ +#endif + +/* + * for select() + */ +#if !defined(WINSOCK) && !defined(_WINDOWS) && !defined(macintosh) && !defined(XP_OS2) +#if defined(hpux) || defined(LINUX) || defined(SUNOS4) +#include <sys/time.h> +#else +#include <sys/select.h> +#endif +#if !defined(FD_SET) +#define NFDBITS 32 +#define FD_SETSIZE 32 +#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) +#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) +#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) +#endif /* !FD_SET */ +#endif /* !WINSOCK && !_WINDOWS && !macintosh */ + + +/* + * for connect() -- must we block signals when calling connect()? This + * is necessary on some buggy UNIXes. + */ +#if !defined(LDAP_CONNECT_MUST_NOT_BE_INTERRUPTED) && \ + ( defined(AIX) || defined(IRIX) || defined(HPUX) || defined(SUNOS4) \ + || defined(SOLARIS) || defined(OSF1) ||defined(freebsd)) +#define LDAP_CONNECT_MUST_NOT_BE_INTERRUPTED +#endif + + +/* + * for signal() -- what do signal handling functions return? + */ +#ifndef SIG_FN +#ifdef sunos5 +# define SIG_FN void /* signal-catching functions return void */ +#else /* sunos5 */ +# ifdef BSD +# if (BSD >= 199006) || defined(NeXT) || defined(OSF1) || defined(sun) || defined(ultrix) || defined(apollo) || defined(POSIX_SIGNALS) +# define SIG_FN void /* signal-catching functions return void */ +# else +# define SIG_FN int /* signal-catching functions return int */ +# endif +# else /* BSD */ +# define SIG_FN void /* signal-catching functions return void */ +# endif /* BSD */ +#endif /* sunos5 */ +#endif /* SIG_FN */ + +/* + * toupper and tolower macros are different under bsd and sys v + */ +#if defined( SYSV ) && !defined( hpux ) +#define TOUPPER(c) (isascii(c) && islower(c) ? _toupper(c) : c) +#define TOLOWER(c) (isascii(c) && isupper(c) ? _tolower(c) : c) +#else +#define TOUPPER(c) (isascii(c) && islower(c) ? toupper(c) : c) +#define TOLOWER(c) (isascii(c) && isupper(c) ? tolower(c) : c) +#endif + +/* + * put a cover on the tty-related ioctl calls we need to use + */ +#if defined( NeXT ) || (defined(SunOS) && SunOS < 40) +#define TERMIO_TYPE struct sgttyb +#define TERMFLAG_TYPE int +#define GETATTR( fd, tiop ) ioctl((fd), TIOCGETP, (caddr_t)(tiop)) +#define SETATTR( fd, tiop ) ioctl((fd), TIOCSETP, (caddr_t)(tiop)) +#define GETFLAGS( tio ) (tio).sg_flags +#define SETFLAGS( tio, flags ) (tio).sg_flags = (flags) +#else +#define USE_TERMIOS +#define TERMIO_TYPE struct termios +#define TERMFLAG_TYPE tcflag_t +#define GETATTR( fd, tiop ) tcgetattr((fd), (tiop)) +#define SETATTR( fd, tiop ) tcsetattr((fd), TCSANOW /* 0 */, (tiop)) +#define GETFLAGS( tio ) (tio).c_lflag +#define SETFLAGS( tio, flags ) (tio).c_lflag = (flags) +#endif + +#if ( !defined( HPUX9 )) && ( !defined( sunos4 )) && ( !defined( SNI )) && \ + ( !defined( HAVE_TIME_R )) +#define HAVE_TIME_R +#endif + +#if defined( sunos5 ) || defined( aix ) +#define HAVE_GETPWNAM_R +#define HAVE_GETGRNAM_R +#endif + +#if defined(SNI) || defined(LINUX1_2) +int strcasecmp(const char *, const char *); +#ifdef SNI +int strncasecmp(const char *, const char *, int); +#endif /* SNI */ +#ifdef LINUX1_2 +int strncasecmp(const char *, const char *, size_t); +#endif /* LINUX1_2 */ +#endif /* SNI || LINUX1_2 */ + +#if defined(_WINDOWS) || defined(macintosh) || defined(XP_OS2) +#define GETHOSTBYNAME( n, r, b, l, e ) gethostbyname( n ) +#define NSLDAPI_CTIME( c, b, l ) ctime( c ) +#define STRTOK( s1, s2, l ) strtok( s1, s2 ) +#else /* UNIX */ +#if defined(sgi) || defined(HPUX9) || defined(LINUX1_2) || defined(SCOOS) || \ + defined(UNIXWARE) || defined(SUNOS4) || defined(SNI) || defined(BSDI) || \ + defined(NCR) || defined(OSF1) || defined(NEC) || \ + ( defined(HPUX10) && !defined(_REENTRANT)) || defined(HPUX11) || \ + defined(UnixWare) || defined(LINUX) || (defined(AIX) && !defined(USE_REENTRANT_LIBC)) +#define GETHOSTBYNAME( n, r, b, l, e ) gethostbyname( n ) +#elif defined(AIX) +/* Maybe this is for another version of AIX? + Commenting out for AIX 4.1 for Nova + Replaced with following to lines, stolen from the #else below +#define GETHOSTBYNAME_BUF_T struct hostent_data +*/ +typedef char GETHOSTBYNAME_buf_t [BUFSIZ /* XXX might be too small */]; +#define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t +#define GETHOSTBYNAME( n, r, b, l, e ) \ + (memset (&b, 0, l), gethostbyname_r (n, r, &b) ? NULL : r) +#elif defined(HPUX10) +#define GETHOSTBYNAME_BUF_T struct hostent_data +#define GETHOSTBYNAME( n, r, b, l, e ) nsldapi_compat_gethostbyname_r( n, r, (char *)&b, l, e ) +#else +#include <stdio.h> /* BUFSIZ */ +typedef char GETHOSTBYNAME_buf_t [BUFSIZ /* XXX might be too small */]; +#define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t +#define GETHOSTBYNAME( n, r, b, l, e ) gethostbyname_r( n, r, b, l, e ) +#endif +#if defined(HPUX9) || defined(LINUX1_2) || defined(LINUX2_0) || \ + defined(LINUX2_1) || defined(SUNOS4) || defined(SNI) || \ + defined(SCOOS) || defined(BSDI) || defined(NCR) || \ + defined(NEC) || ( defined(HPUX10) && !defined(_REENTRANT)) || \ + (defined(AIX) && !defined(USE_REENTRANT_LIBC)) +#define NSLDAPI_CTIME( c, b, l ) ctime( c ) +#elif defined(HPUX10) && defined(_REENTRANT) && !defined(HPUX11) +#define NSLDAPI_CTIME( c, b, l ) nsldapi_compat_ctime_r( c, b, l ) +#elif defined( IRIX6_2 ) || defined( IRIX6_3 ) || defined(UNIXWARE) \ + || defined(OSF1V4) || defined(AIX) || defined(UnixWare) || defined(hpux) || defined(HPUX11) +#define NSLDAPI_CTIME( c, b, l ) ctime_r( c, b ) +#elif defined( OSF1V3 ) +#define NSLDAPI_CTIME( c, b, l ) (ctime_r( c, b, l ) ? NULL : b) +#else +#define NSLDAPI_CTIME( c, b, l ) ctime_r( c, b, l ) +#endif +#if defined(hpux9) || defined(LINUX1_2) || defined(SUNOS4) || defined(SNI) || \ + defined(SCOOS) || defined(BSDI) || defined(NCR) || \ + defined(NEC) || defined(LINUX) || (defined(AIX) && !defined(USE_REENTRANT_LIBC)) +#define STRTOK( s1, s2, l ) strtok( s1, s2 ) +#else +#define HAVE_STRTOK_R +char *strtok_r(char *, const char *, char **); +#define STRTOK( s1, s2, l ) (char *)strtok_r( s1, s2, l ) +#endif /* STRTOK */ +#endif /* UNIX */ + +#if defined( ultrix ) || defined( nextstep ) +extern char *strdup(); +#endif /* ultrix || nextstep */ + +#if defined( sunos4 ) || defined( OSF1 ) +#define BSD_TIME 1 /* for servers/slapd/log.h */ +#endif /* sunos4 || osf */ + +#if !defined(_WINDOWS) && !defined(macintosh) +#include <netinet/in.h> +#include <arpa/inet.h> /* for inet_addr() */ +#endif + +/* + * Define a portable type for IPv4 style Internet addresses (32 bits): + */ +#if ( defined(sunos5) && defined(_IN_ADDR_T)) || \ + defined(aix) || defined(HPUX11) || defined(OSF1) || defined(SOLARIS) +typedef in_addr_t nsldapi_in_addr_t; +#else +typedef unsigned long nsldapi_in_addr_t; +#endif + +#ifdef SUNOS4 +#include <pcfs/pc_dir.h> /* for toupper() */ +int fprintf(FILE *, char *, ...); +int fseek(FILE *, long, int); +int fread(char *, int, int, FILE *); +int fclose(FILE *); +int fflush(FILE *); +int rewind(FILE *); +void *memmove(void *, const void *, size_t); +int strcasecmp(char *, char *); +int strncasecmp(char *, char *, int); +time_t time(time_t *); +void perror(char *); +int fputc(char, FILE *); +int fputs(char *, FILE *); +int re_exec(char *); +int socket(int, int, int); +void bzero(char *, int); +unsigned long inet_addr(char *); +char * inet_ntoa(struct in_addr); +int getdtablesize(); +int connect(int, struct sockaddr *, int); +#endif /* SUNOS4 */ + +/* #if defined(SUNOS4) || defined(SNI) */ +#if defined(SUNOS4) +int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +#endif /* SUNOS4 || SNI */ + +/* + * SAFEMEMCPY is an overlap-safe copy from s to d of n bytes + * This is moved to lber.h in Solaris + */ +#ifndef _SOLARIS_SDK +#ifdef macintosh +#define SAFEMEMCPY( d, s, n ) BlockMoveData( (Ptr)s, (Ptr)d, n ) +#else /* macintosh */ +#ifdef sunos4 +#define SAFEMEMCPY( d, s, n ) bcopy( s, d, n ) +#else /* sunos4 */ +#define SAFEMEMCPY( d, s, n ) memmove( d, s, n ) +#endif /* sunos4 */ +#endif /* macintosh */ +#endif /* ifndef _SOLARIS_SDK */ + +#ifdef _WINDOWS + +#define strcasecmp strcmpi +#define strncasecmp _strnicmp +#define bzero(a, b) memset( a, 0, b ) +#define getpid _getpid +#define ioctl ioctlsocket +#define sleep(a) Sleep( a*1000 ) + +#define EMSGSIZE WSAEMSGSIZE +#define EWOULDBLOCK WSAEWOULDBLOCK +#define EHOSTUNREACH WSAEHOSTUNREACH + +#ifndef MAXPATHLEN +#define MAXPATHLEN _MAX_PATH +#endif + +/* We'd like this number to be prime for the hash + * into the Connection table */ +#define DS_MAX_NT_SOCKET_CONNECTIONS 2003 + +#elif defined(XP_OS2) + +#define strcasecmp strcmpi +#define strncasecmp strnicmp +#define bzero(a, b) memset( a, 0, b ) +#include "dirent.h" +#include <string.h> /*for strcmpi()*/ +#include <time.h> /*for ctime()*/ + +#endif /* XP_OS2 */ + + +#endif /* _PORTABLE_H */ diff --git a/usr/src/lib/libldap5/include/ldap/sec.h b/usr/src/lib/libldap5/include/ldap/sec.h new file mode 100644 index 0000000000..de00db7560 --- /dev/null +++ b/usr/src/lib/libldap5/include/ldap/sec.h @@ -0,0 +1,14 @@ +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _SEC_H_ +#define _SEC_H_ + +#include <sys/types.h> +#include <md5.h> + +void hmac_md5(unsigned char *text, int text_len, unsigned char *key, + int key_len, unsigned char *digest); + +char *hexa_print(unsigned char *aString, int aLen); + +#endif /* _SEC_H_ */ diff --git a/usr/src/lib/libldap5/include/ldap/solaris-int.h b/usr/src/lib/libldap5/include/ldap/solaris-int.h new file mode 100644 index 0000000000..f092b8805a --- /dev/null +++ b/usr/src/lib/libldap5/include/ldap/solaris-int.h @@ -0,0 +1,548 @@ +/* + * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _SOLARISINT_H +#define _SOLARISINT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdio.h> +#include <ctype.h> +#include <stdarg.h> +#include <stdlib.h> + +#include "ldap.h" + +/* + * These were moved from lber.h. This should have been ifdef'd with + * _SOLARIS_SDK but since we do not want to expose these in lber.h its + * not possible to ifndef it there. + */ + +/* BerElement set/get options */ +#define LBER_OPT_REMAINING_BYTES 0x01 +#define LBER_OPT_TOTAL_BYTES 0x02 +#define LBER_OPT_USE_DER 0x04 +#define LBER_OPT_TRANSLATE_STRINGS 0x08 +#define LBER_OPT_BYTES_TO_WRITE 0x10 +#define LBER_OPT_MEMALLOC_FN_PTRS 0x20 +#define LBER_OPT_DEBUG_LEVEL 0x40 +/* + * LBER_USE_DER is defined for compatibility with the C LDAP API RFC. + * In our implementation, we recognize it (instead of the numerically + * identical LBER_OPT_REMAINING_BYTES) in calls to ber_alloc_t() and + * ber_init_w_nullchar() only. Callers of ber_set_option() or + * ber_get_option() must use LBER_OPT_USE_DER instead. Sorry! + */ +#define LBER_USE_DER 0x01 + +/* Sockbuf set/get options */ +#define LBER_SOCKBUF_OPT_TO_FILE 0x001 +#define LBER_SOCKBUF_OPT_TO_FILE_ONLY 0x002 +#define LBER_SOCKBUF_OPT_MAX_INCOMING_SIZE 0x004 +#define LBER_SOCKBUF_OPT_NO_READ_AHEAD 0x008 +#define LBER_SOCKBUF_OPT_DESC 0x010 +#define LBER_SOCKBUF_OPT_COPYDESC 0x020 +#define LBER_SOCKBUF_OPT_READ_FN 0x040 +#define LBER_SOCKBUF_OPT_WRITE_FN 0x080 +#define LBER_SOCKBUF_OPT_EXT_IO_FNS 0x100 + +#ifndef _SOLARIS_SDK +/* + * The following is not used by solaris. Just kept to stay in sync with + * iplanet and also a place holder (0x200) + */ +#define LBER_SOCKBUF_OPT_VALID_TAG 0x200 +#endif /* !_SOLARIS_SDK */ + +/* + * Socket buffer structure associated to the LDAP connection + */ +#define LDAP_X_OPT_SOCKBUF (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F02) + /* 0x4000 + 0x0F02 = 0x4F02 = 20226 - API extension */ + + +#define LBER_OPT_ON ((void *) 1) +#define LBER_OPT_OFF ((void *) 0) + +/* Used in various functions */ +#define LBER_FUNC_VALUE -1 + +struct lextiof_socket_private; /* Defined by the extended I/O */ + /* callback functions */ +struct lextiof_session_private; /* Defined by the extended I/O */ + /* callback functions */ + +/* This is modeled after the PRIOVec that is passed to the NSPR + writev function! The void* is a char* in that struct */ +typedef struct ldap_x_iovec { + char *ldapiov_base; + int ldapiov_len; +} ldap_x_iovec; + +/* + * libldap read and write I/O function callbacks. The rest of the I/O callback + * types are defined in ldap.h + */ +typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_READ_CALLBACK)( LBER_SOCKET s, + void *buf, int bufsize ); +typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_WRITE_CALLBACK)( LBER_SOCKET s, + const void *buf, int len ); +typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_READ_CALLBACK)( int s, + void *buf, int bufsize, struct lextiof_socket_private *arg ); +typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_WRITE_CALLBACK)( int s, + const void *buf, int len, struct lextiof_socket_private *arg ); +typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_WRITEV_CALLBACK)(int s, + const ldap_x_iovec iov[], int iovcnt, struct lextiof_socket_private *socketarg); + + +/* + * Structure for use with LBER_SOCKBUF_OPT_EXT_IO_FNS: + */ +struct lber_x_ext_io_fns { + /* lbextiofn_size should always be set to LBER_X_EXTIO_FNS_SIZE */ + int lbextiofn_size; + LDAP_X_EXTIOF_READ_CALLBACK *lbextiofn_read; + LDAP_X_EXTIOF_WRITE_CALLBACK *lbextiofn_write; + struct lextiof_socket_private *lbextiofn_socket_arg; + LDAP_X_EXTIOF_WRITEV_CALLBACK *lbextiofn_writev; +}; +#define LBER_X_EXTIO_FNS_SIZE sizeof(struct lber_x_ext_io_fns) + +/* + * liblber memory allocation callback functions. These are global to all + * Sockbufs and BerElements. Install your own functions by using a call + * like this: ber_set_option( NULL, LBER_OPT_MEMALLOC_FN_PTRS, &memalloc_fns ); + */ +typedef void * (LDAP_C LDAP_CALLBACK LDAP_MALLOC_CALLBACK)( size_t size ); +typedef void * (LDAP_C LDAP_CALLBACK LDAP_CALLOC_CALLBACK)( size_t nelem, + size_t elsize ); +typedef void * (LDAP_C LDAP_CALLBACK LDAP_REALLOC_CALLBACK)( void *ptr, + size_t size ); +typedef void (LDAP_C LDAP_CALLBACK LDAP_FREE_CALLBACK)( void *ptr ); + +struct lber_memalloc_fns { + LDAP_MALLOC_CALLBACK *lbermem_malloc; + LDAP_CALLOC_CALLBACK *lbermem_calloc; + LDAP_REALLOC_CALLBACK *lbermem_realloc; + LDAP_FREE_CALLBACK *lbermem_free; +}; + +/* + * Functions marked as Project Private in PSARC case and moved + * from lber.h + */ +typedef struct sockbuf Sockbuf; + +LDAP_API(void) LDAP_CALL ber_special_free(void* buf, BerElement *ber); +LDAP_API(void*) LDAP_CALL ber_special_alloc(size_t size, BerElement **ppBer); +LDAP_API(ber_uint_t) LDAP_CALL ber_get_next_buffer( void *buffer, + size_t buffer_size, ber_len_t *len, BerElement *ber, + ber_uint_t *Bytes_Scanned ); +LDAP_API(ber_uint_t) LDAP_CALL ber_get_next_buffer_ext( void *buffer, + size_t buffer_size, ber_len_t *len, BerElement *ber, + ber_len_t *Bytes_Scanned, Sockbuf *sb ); +LDAP_API(void) LDAP_CALL ber_init_w_nullchar( BerElement *ber, int options ); +LDAP_API(int) LDAP_CALL ber_set_option( BerElement *ber, int option, + void *value ); +LDAP_API(int) LDAP_CALL ber_get_option( BerElement *ber, int option, + void *value ); +LDAP_API(Sockbuf*) LDAP_CALL ber_sockbuf_alloc( void ); +LDAP_API(void) LDAP_CALL ber_sockbuf_free( Sockbuf* p ); +LDAP_API(int) LDAP_CALL ber_sockbuf_set_option( Sockbuf *sb, int option, + void *value ); +LDAP_API(int) LDAP_CALL ber_sockbuf_get_option( Sockbuf *sb, int option, + void *value ); +LDAP_API(int) LDAP_CALL ber_flush( Sockbuf *sb, BerElement *ber, int freeit ); +LDAP_API(ber_tag_t) LDAP_CALL ber_get_next( Sockbuf *sb, ber_len_t *len, + BerElement *ber ); + +/* + * The following was moved from ldap.h + */ + +/* + * These extended I/O function callbacks echo the BSD socket API but accept + * an extra pointer parameter at the end of their argument list that can + * be used by client applications for their own needs. For some of the calls, + * the pointer is a session argument of type struct lextiof_session_private * + * that is associated with the LDAP session handle (LDAP *). For others, the + * pointer is a socket specific struct lextiof_socket_private * argument that + * is associated with a particular socket (a TCP connection). + * + * The lextiof_session_private and lextiof_socket_private structures are not + * defined by the LDAP C API; users of this extended I/O interface should + * define these themselves. + * + * The combination of the integer socket number (i.e., lpoll_fd, which is + * the value returned by the CONNECT callback) and the application specific + * socket argument (i.e., lpoll_socketarg, which is the value set in *sockargpp + * by the CONNECT callback) must be unique. + * + * The types for the extended READ and WRITE callbacks are actually in lber.h. + * + * The CONNECT callback gets passed both the session argument (sessionarg) + * and a pointer to a socket argument (socketargp) so it has the + * opportunity to set the socket-specific argument. The CONNECT callback + * also takes a timeout parameter whose value can be set by calling + * ldap_set_option( ld, LDAP_X_OPT_..., &val ). The units used for the + * timeout parameter are milliseconds. + * + * A POLL interface is provided instead of a select() one. The timeout is + * in milliseconds. + + * A NEWHANDLE callback function is also provided. It is called right + * after the LDAP session handle is created, e.g., during ldap_init(). + * If the NEWHANDLE callback returns anything other than LDAP_SUCCESS, + * the session handle allocation fails. + * + * A DISPOSEHANDLE callback function is also provided. It is called right + * before the LDAP session handle and its contents are destroyed, e.g., + * during ldap_unbind(). + */ + +/* LDAP poll()-like descriptor: + */ +typedef struct ldap_x_pollfd { /* used by LDAP_X_EXTIOF_POLL_CALLBACK */ + int lpoll_fd; /* integer file descriptor / socket */ + struct lextiof_socket_private + *lpoll_socketarg; + /* pointer socket and for use by */ + /* application */ + short lpoll_events; /* requested event */ + short lpoll_revents; /* returned event */ +} LDAP_X_PollFD; + +/* Event flags for lpoll_events and lpoll_revents: + */ +#define LDAP_X_POLLIN 0x01 /* regular data ready for reading */ +#define LDAP_X_POLLPRI 0x02 /* high priority data available */ +#define LDAP_X_POLLOUT 0x04 /* ready for writing */ +#define LDAP_X_POLLERR 0x08 /* error occurred -- only in lpoll_revents */ +#define LDAP_X_POLLHUP 0x10 /* connection closed -- only in lpoll_revents */ +#define LDAP_X_POLLNVAL 0x20 /* invalid lpoll_fd -- only in lpoll_revents */ + +/* Options passed to LDAP_X_EXTIOF_CONNECT_CALLBACK to modify socket behavior: + */ +#define LDAP_X_EXTIOF_OPT_NONBLOCKING 0x01 /* turn on non-blocking mode */ +#define LDAP_X_EXTIOF_OPT_SECURE 0x02 /* turn on 'secure' mode */ + +/* extended I/O callback function prototypes: + */ +typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_CONNECT_CALLBACK )( + const char *hostlist, int port, /* host byte order */ + int timeout /* milliseconds */, + unsigned long options, /* bitmapped options */ + struct lextiof_session_private *sessionarg, + struct lextiof_socket_private **socketargp +#ifdef _SOLARIS_SDK + , void **datapriv ); +#else + ); +#endif +typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_CLOSE_CALLBACK )( + int s, struct lextiof_socket_private *socketarg ); +typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_POLL_CALLBACK)( + LDAP_X_PollFD fds[], int nfds, int timeout /* milliseconds */, + struct lextiof_session_private *sessionarg ); +typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_NEWHANDLE_CALLBACK)( + LDAP *ld, struct lextiof_session_private *sessionarg ); +typedef void (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK)( + LDAP *ld, struct lextiof_session_private *sessionarg ); + + +/* Structure to hold extended I/O function pointers: + */ +struct ldap_x_ext_io_fns { + /* lextiof_size should always be set to LDAP_X_EXTIO_FNS_SIZE */ + int lextiof_size; + LDAP_X_EXTIOF_CONNECT_CALLBACK *lextiof_connect; + LDAP_X_EXTIOF_CLOSE_CALLBACK *lextiof_close; + LDAP_X_EXTIOF_READ_CALLBACK *lextiof_read; + LDAP_X_EXTIOF_WRITE_CALLBACK *lextiof_write; + LDAP_X_EXTIOF_POLL_CALLBACK *lextiof_poll; + LDAP_X_EXTIOF_NEWHANDLE_CALLBACK *lextiof_newhandle; + LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK *lextiof_disposehandle; + void *lextiof_session_arg; + LDAP_X_EXTIOF_WRITEV_CALLBACK *lextiof_writev; +}; +#define LDAP_X_EXTIO_FNS_SIZE sizeof(struct ldap_x_ext_io_fns) + + +/* + * Utility functions for parsing space-separated host lists (useful for + * implementing an extended I/O CONNECT callback function). + */ +struct ldap_x_hostlist_status; +LDAP_API(int) LDAP_CALL ldap_x_hostlist_first( const char *hostlist, + int defport, char **hostp, int *portp /* host byte order */, + struct ldap_x_hostlist_status **statusp ); +LDAP_API(int) LDAP_CALL ldap_x_hostlist_next( char **hostp, + int *portp /* host byte order */, struct ldap_x_hostlist_status *status ); +LDAP_API(void) LDAP_CALL ldap_x_hostlist_statusfree( + struct ldap_x_hostlist_status *status ); + + +/* + * I/O callback functions (note that types for the read and write callbacks + * are actually in lber.h): + */ +typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_SELECT_CALLBACK)( int nfds, + fd_set *readfds, fd_set *writefds, fd_set *errorfds, + struct timeval *timeout ); +typedef LBER_SOCKET (LDAP_C LDAP_CALLBACK LDAP_IOF_SOCKET_CALLBACK)( + int domain, int type, int protocol ); +typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_IOCTL_CALLBACK)( LBER_SOCKET s, + int option, ... ); +typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_CONNECT_CALLBACK )( + LBER_SOCKET s, struct sockaddr *name, int namelen ); +typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_CLOSE_CALLBACK )( + LBER_SOCKET s ); +typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_SSL_ENABLE_CALLBACK )( + LBER_SOCKET s ); + + +/* + * Structure to hold I/O function pointers: + */ +struct ldap_io_fns { + LDAP_IOF_READ_CALLBACK *liof_read; + LDAP_IOF_WRITE_CALLBACK *liof_write; + LDAP_IOF_SELECT_CALLBACK *liof_select; + LDAP_IOF_SOCKET_CALLBACK *liof_socket; + LDAP_IOF_IOCTL_CALLBACK *liof_ioctl; + LDAP_IOF_CONNECT_CALLBACK *liof_connect; + LDAP_IOF_CLOSE_CALLBACK *liof_close; + LDAP_IOF_SSL_ENABLE_CALLBACK *liof_ssl_enable; +}; + +/********* the functions in the following section are experimental ***********/ + +#define LDAP_OPT_PREFERRED_LANGUAGE 0x14 /* 20 - API extension */ + +/* + * SSL option (an API extension): + */ +#define LDAP_OPT_SSL 0x0A /* 10 - API extension */ + +/* + * Referral hop limit (an API extension): + */ +#define LDAP_OPT_REFERRAL_HOP_LIMIT 0x10 /* 16 - API extension */ + +/* + * DNS resolver callbacks (an API extension --LDAP_API_FEATURE_X_DNS_FUNCTIONS). + * Note that gethostbyaddr() is not currently used. + */ +#define LDAP_OPT_DNS_FN_PTRS 0x60 /* 96 - API extension */ + +typedef struct LDAPHostEnt { + char *ldaphe_name; /* official name of host */ + char **ldaphe_aliases; /* alias list */ + int ldaphe_addrtype; /* host address type */ + int ldaphe_length; /* length of address */ + char **ldaphe_addr_list; /* list of addresses from name server */ +} LDAPHostEnt; + +typedef LDAPHostEnt * (LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETHOSTBYNAME)( + const char *name, LDAPHostEnt *result, char *buffer, + int buflen, int *statusp, void *extradata); +typedef LDAPHostEnt * (LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETHOSTBYADDR)( + const char *addr, int length, int type, LDAPHostEnt *result, + char *buffer, int buflen, int *statusp, void *extradata); +typedef int (LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETPEERNAME)( + LDAP *ld, struct sockaddr *netaddr, char *buffer, int buflen); + +struct ldap_dns_fns { + void *lddnsfn_extradata; + int lddnsfn_bufsize; + LDAP_DNSFN_GETHOSTBYNAME *lddnsfn_gethostbyname; + LDAP_DNSFN_GETHOSTBYADDR *lddnsfn_gethostbyaddr; + LDAP_DNSFN_GETPEERNAME *lddnsfn_getpeername; +}; + +/* + * Generalized cache callback interface: + */ +#define LDAP_OPT_CACHE_FN_PTRS 0x0D /* 13 - API extension */ +#define LDAP_OPT_CACHE_STRATEGY 0x0E /* 14 - API extension */ +#define LDAP_OPT_CACHE_ENABLE 0x0F /* 15 - API extension */ + +/* cache strategies */ +#define LDAP_CACHE_CHECK 0 +#define LDAP_CACHE_POPULATE 1 +#define LDAP_CACHE_LOCALDB 2 + +typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_BIND_CALLBACK)(LDAP *ld, int msgid, + ber_tag_t tag, const char *dn, const struct berval *creds, + int method); +typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_UNBIND_CALLBACK)(LDAP *ld, + int unused0, unsigned long unused1); +typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_SEARCH_CALLBACK)(LDAP *ld, + int msgid, ber_tag_t tag, const char *base, int scope, + const char LDAP_CALLBACK *filter, char **attrs, int attrsonly); +typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_COMPARE_CALLBACK)(LDAP *ld, + int msgid, ber_tag_t tag, const char *dn, const char *attr, + const struct berval *value); +typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_ADD_CALLBACK)(LDAP *ld, + int msgid, ber_tag_t tag, const char *dn, LDAPMod **attrs); +typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_DELETE_CALLBACK)(LDAP *ld, + int msgid, ber_tag_t tag, const char *dn); +typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_MODIFY_CALLBACK)(LDAP *ld, + int msgid, ber_tag_t tag, const char *dn, LDAPMod **mods); +typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_MODRDN_CALLBACK)(LDAP *ld, + int msgid, ber_tag_t tag, const char *dn, const char *newrdn, + int deleteoldrdn); +typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_RESULT_CALLBACK)(LDAP *ld, + int msgid, int all, struct timeval *timeout, LDAPMessage **result); +typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_FLUSH_CALLBACK)(LDAP *ld, + const char *dn, const char *filter); + +struct ldap_cache_fns { + void *lcf_private; + LDAP_CF_BIND_CALLBACK *lcf_bind; + LDAP_CF_UNBIND_CALLBACK *lcf_unbind; + LDAP_CF_SEARCH_CALLBACK *lcf_search; + LDAP_CF_COMPARE_CALLBACK *lcf_compare; + LDAP_CF_ADD_CALLBACK *lcf_add; + LDAP_CF_DELETE_CALLBACK *lcf_delete; + LDAP_CF_MODIFY_CALLBACK *lcf_modify; + LDAP_CF_MODRDN_CALLBACK *lcf_modrdn; + LDAP_CF_RESULT_CALLBACK *lcf_result; + LDAP_CF_FLUSH_CALLBACK *lcf_flush; +}; + +int LDAP_CALL ldap_cache_flush(LDAP *ld, const char *dn, + const char *filter); + +/* + * Memory allocation callback functions (an API extension -- + * LDAP_API_FEATURE_X_MEMALLOC_FUNCTIONS). These are global and can + * not be set on a per-LDAP session handle basis. Install your own + * functions by making a call like this: + * ldap_set_option( NULL, LDAP_OPT_MEMALLOC_FN_PTRS, &memalloc_fns ); + * + * look in lber.h for the function typedefs themselves. + */ +#define LDAP_OPT_MEMALLOC_FN_PTRS 0x61 /* 97 - API extension */ + +struct ldap_memalloc_fns { + LDAP_MALLOC_CALLBACK *ldapmem_malloc; + LDAP_CALLOC_CALLBACK *ldapmem_calloc; + LDAP_REALLOC_CALLBACK *ldapmem_realloc; + LDAP_FREE_CALLBACK *ldapmem_free; +}; + + +/* + * Memory allocation functions (an API extension) + */ +void *ldap_x_malloc( size_t size ); +void *ldap_x_calloc( size_t nelem, size_t elsize ); +void *ldap_x_realloc( void *ptr, size_t size ); +void ldap_x_free( void *ptr ); + +/* + * Extra thread callback functions (an API extension -- + * LDAP_API_FEATURE_X_EXTHREAD_FUNCTIONS) + */ +#define LDAP_OPT_EXTRA_THREAD_FN_PTRS 0x65 /* 101 - API extension */ + +typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_TRYLOCK_CALLBACK)( void *m ); +typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_ALLOC_CALLBACK)( void ); +typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_FREE_CALLBACK)( void *s ); +typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_WAIT_CALLBACK)( void *s ); +typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_POST_CALLBACK)( void *s ); +typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_THREADID_CALLBACK)(void); + +struct ldap_extra_thread_fns { + LDAP_TF_MUTEX_TRYLOCK_CALLBACK *ltf_mutex_trylock; + LDAP_TF_SEMA_ALLOC_CALLBACK *ltf_sema_alloc; + LDAP_TF_SEMA_FREE_CALLBACK *ltf_sema_free; + LDAP_TF_SEMA_WAIT_CALLBACK *ltf_sema_wait; + LDAP_TF_SEMA_POST_CALLBACK *ltf_sema_post; + LDAP_TF_THREADID_CALLBACK *ltf_threadid_fn; +}; + + +/* + * Debugging level (an API extension) + */ +#define LDAP_OPT_DEBUG_LEVEL 0x6E /* 110 - API extension */ +/* On UNIX, there's only one copy of ldap_debug */ +/* On NT, each dll keeps its own module_ldap_debug, which */ +/* points to the process' ldap_debug and needs initializing after load */ +#ifdef _WIN32 +extern int *module_ldap_debug; +typedef void (*set_debug_level_fn_t)(int*); +#endif + +/************************ end of experimental section ************************/ + + +LDAP_API(int) LDAP_CALL ldap_keysort_entries( LDAP *ld, LDAPMessage **chain, + void *arg, LDAP_KEYGEN_CALLBACK *gen, LDAP_KEYCMP_CALLBACK *cmp, + LDAP_KEYFREE_CALLBACK *fre ); + +/* + * utility routines + */ +LDAP_API(int) LDAP_CALL ldap_charray_add( char ***a, char *s ); +LDAP_API(int) LDAP_CALL ldap_charray_merge( char ***a, char **s ); +LDAP_API(void) LDAP_CALL ldap_charray_free( char **array ); +LDAP_API(int) LDAP_CALL ldap_charray_inlist( char **a, char *s ); +LDAP_API(char **) LDAP_CALL ldap_charray_dup( char **a ); +LDAP_API(char **) LDAP_CALL ldap_str2charray( char *str, char *brkstr ); +LDAP_API(int) LDAP_CALL ldap_charray_position( char **a, char *s ); + +/* + * UTF-8 routines (should these move into libnls?) + */ +/* number of bytes in character */ +LDAP_API(int) LDAP_CALL ldap_utf8len( const char* ); +/* find next character */ +LDAP_API(char*) LDAP_CALL ldap_utf8next( char* ); +/* find previous character */ +LDAP_API(char*) LDAP_CALL ldap_utf8prev( char* ); +/* copy one character */ +LDAP_API(int) LDAP_CALL ldap_utf8copy( char* dst, const char* src ); +/* total number of characters */ +LDAP_API(size_t) LDAP_CALL ldap_utf8characters( const char* ); +/* get one UCS-4 character, and move *src to the next character */ +LDAP_API(unsigned long) LDAP_CALL ldap_utf8getcc( const char** src ); +/* UTF-8 aware strtok_r() */ +LDAP_API(char*) LDAP_CALL ldap_utf8strtok_r( char* src, const char* brk, char** next); + +/* like isalnum(*s) in the C locale */ +LDAP_API(int) LDAP_CALL ldap_utf8isalnum( char* s ); +/* like isalpha(*s) in the C locale */ +LDAP_API(int) LDAP_CALL ldap_utf8isalpha( char* s ); +/* like isdigit(*s) in the C locale */ +LDAP_API(int) LDAP_CALL ldap_utf8isdigit( char* s ); +/* like isxdigit(*s) in the C locale */ +LDAP_API(int) LDAP_CALL ldap_utf8isxdigit(char* s ); +/* like isspace(*s) in the C locale */ +LDAP_API(int) LDAP_CALL ldap_utf8isspace( char* s ); + +#define LDAP_UTF8LEN(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8len (s) : 1) +#define LDAP_UTF8NEXT(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8next(s) : (s)+1) +#define LDAP_UTF8INC(s) ((0x80 & *(unsigned char*)(s)) ? s=ldap_utf8next(s) : ++s) + +#define LDAP_UTF8PREV(s) ldap_utf8prev(s) +#define LDAP_UTF8DEC(s) (s=ldap_utf8prev(s)) + +#define LDAP_UTF8COPY(d,s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8copy(d,s) : ((*(d) = *(s)), 1)) +#define LDAP_UTF8GETCC(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8getcc (&s) : *s++) +#define LDAP_UTF8GETC(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8getcc ((const char**)&s) : *s++) + +#ifdef __cplusplus +} +#endif +#endif /* _SOLARISINT_H */ + diff --git a/usr/src/lib/libldap5/include/ldap/solaris-priv.h b/usr/src/lib/libldap5/include/ldap/solaris-priv.h new file mode 100644 index 0000000000..3e568b5d66 --- /dev/null +++ b/usr/src/lib/libldap5/include/ldap/solaris-priv.h @@ -0,0 +1,36 @@ +/* + * Copyright 2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SOLARISPRIV_H +#define _SOLARISPRIV_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * solaris-priv.h - items not exposed to outside but used by solaris clients + * of ldap + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Well-behaved extensions private to solaris OS will use option values + * between 0x3000 and 0x3FFF inclusive. + */ +#define LDAP_OPT_SOLARIS_EXTENSION_BASE 0x3000 /* to 0x3FFF inclusive */ + +/* + * Option to install "SKIP a data base" dns routines + */ +#define LDAP_X_OPT_DNS_SKIPDB (LDAP_OPT_SOLARIS_EXTENSION_BASE + 0x0F01) + + +#ifdef __cplusplus +} +#endif + +#endif /* _SOLARISPRIV_H */ diff --git a/usr/src/lib/libldap5/include/ldap/srchpref.h b/usr/src/lib/libldap5/include/ldap/srchpref.h new file mode 100644 index 0000000000..03afaf3a0f --- /dev/null +++ b/usr/src/lib/libldap5/include/ldap/srchpref.h @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998-1999 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* + * Copyright (c) 1993, 1994 Regents of the University of Michigan. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of Michigan at Ann Arbor. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + * + * searchpref.h: display template library defines + */ + + +#ifndef _SRCHPREF_H +#define _SRCHPREF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* calling conventions used by library */ +#ifndef LDAP_CALL +#if defined( _WINDOWS ) || defined( _WIN32 ) +#define LDAP_C __cdecl +#ifndef _WIN32 +#define __stdcall _far _pascal +#define LDAP_CALLBACK _loadds +#else +#define LDAP_CALLBACK +#endif /* _WIN32 */ +#define LDAP_PASCAL __stdcall +#define LDAP_CALL LDAP_PASCAL +#else /* _WINDOWS */ +#define LDAP_C +#define LDAP_CALLBACK +#define LDAP_PASCAL +#define LDAP_CALL +#endif /* _WINDOWS */ +#endif /* LDAP_CALL */ + +#ifndef _SOLARIS_SDK + +struct ldap_searchattr { + char *sa_attrlabel; + char *sa_attr; + /* max 32 matchtypes for now */ + unsigned long sa_matchtypebitmap; + char *sa_selectattr; + char *sa_selecttext; + struct ldap_searchattr *sa_next; +}; + +struct ldap_searchmatch { + char *sm_matchprompt; + char *sm_filter; + struct ldap_searchmatch *sm_next; +}; + +struct ldap_searchobj { + char *so_objtypeprompt; + unsigned long so_options; + char *so_prompt; + short so_defaultscope; + char *so_filterprefix; + char *so_filtertag; + char *so_defaultselectattr; + char *so_defaultselecttext; + struct ldap_searchattr *so_salist; + struct ldap_searchmatch *so_smlist; + struct ldap_searchobj *so_next; +}; + +#define NULLSEARCHOBJ ((struct ldap_searchobj *)0) + +/* + * global search object options + */ +#define LDAP_SEARCHOBJ_OPT_INTERNAL 0x00000001 + +#define LDAP_IS_SEARCHOBJ_OPTION_SET( so, option ) \ + (((so)->so_options & option ) != 0 ) + +#define LDAP_SEARCHPREF_VERSION_ZERO 0 +#define LDAP_SEARCHPREF_VERSION 1 + +#define LDAP_SEARCHPREF_ERR_VERSION 1 +#define LDAP_SEARCHPREF_ERR_MEM 2 +#define LDAP_SEARCHPREF_ERR_SYNTAX 3 +#define LDAP_SEARCHPREF_ERR_FILE 4 + + +LDAP_API(int) +LDAP_CALL +ldap_init_searchprefs( char *file, struct ldap_searchobj **solistp ); + +LDAP_API(int) +LDAP_CALL +ldap_init_searchprefs_buf( char *buf, long buflen, + struct ldap_searchobj **solistp ); + +LDAP_API(void) +LDAP_CALL +ldap_free_searchprefs( struct ldap_searchobj *solist ); + +LDAP_API(struct ldap_searchobj *) +LDAP_CALL +ldap_first_searchobj( struct ldap_searchobj *solist ); + +LDAP_API(struct ldap_searchobj *) +LDAP_CALL +ldap_next_searchobj( struct ldap_searchobj *sollist, + struct ldap_searchobj *so ); + +#endif /* _SOLARIS_SDK */ + +#ifdef __cplusplus +} +#endif +#endif /* _SRCHPREF_H */ |