summaryrefslogtreecommitdiffstats
path: root/ldap/include
diff options
context:
space:
mode:
authorcvsadm <cvsadm>2005-01-21 00:44:34 +0000
committercvsadm <cvsadm>2005-01-21 00:44:34 +0000
commitb2093e3016027d6b5cf06b3f91f30769bfc099e2 (patch)
treecf58939393a9032182c4fbc4441164a9456e82f8 /ldap/include
downloadds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.tar.gz
ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.tar.xz
ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.zip
Moving NSCP Directory Server from DirectoryBranch to TRUNK, initial drop. (foxworth)ldapserver7x
Diffstat (limited to 'ldap/include')
-rw-r--r--ldap/include/Makefile53
-rw-r--r--ldap/include/Makefile.client54
-rw-r--r--ldap/include/avl.h67
-rw-r--r--ldap/include/dblayer.h7
-rw-r--r--ldap/include/dirlite_strings.h62
-rw-r--r--ldap/include/disptmpl.h348
-rw-r--r--ldap/include/ldaplog.h84
-rw-r--r--ldap/include/ldaprot.h167
-rw-r--r--ldap/include/ldbm.h380
-rw-r--r--ldap/include/ldif.h76
-rw-r--r--ldap/include/litekey.h30
-rw-r--r--ldap/include/lthread.h423
-rw-r--r--ldap/include/ntslapdregparms.h41
-rw-r--r--ldap/include/ntwatchdog.h68
-rw-r--r--ldap/include/portable.h380
-rw-r--r--ldap/include/proto-ntutil.h79
-rw-r--r--ldap/include/regex.h63
-rw-r--r--ldap/include/srchpref.h123
-rw-r--r--ldap/include/sysexits-compat.h107
19 files changed, 2612 insertions, 0 deletions
diff --git a/ldap/include/Makefile b/ldap/include/Makefile
new file mode 100644
index 00000000..cbd7c034
--- /dev/null
+++ b/ldap/include/Makefile
@@ -0,0 +1,53 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#
+# GNU Makefile for ldap/include
+#
+
+LDAP_SRC = ..
+MCOM_ROOT = ../../..
+
+NOSTDCLEAN=true # don't let nsconfig.mk define target clean
+NOSTDSTRIP=true # don't let nsconfig.mk define target strip
+NSPR20=true # probably should be defined somewhere else (not sure where)
+
+include $(MCOM_ROOT)/ldapserver/nsdefs.mk
+include $(MCOM_ROOT)/ldapserver/nsconfig.mk
+include $(LDAP_SRC)/nsldap.mk
+
+ifneq ($(ARCH), WINNT)
+PROT= -m 644
+endif
+
+all: FORCE
+
+$(LDAP_INCLUDEDIR):
+ $(MKDIR) $(LDAP_INCLUDEDIR)
+
+clientSDK: $(LDAP_INCLUDEDIR) all FORCE
+ $(INSTALL) $(INSTALLFLAGS) $(PROT) ldap.h $(LDAP_INCLUDEDIR)
+ $(INSTALL) $(INSTALLFLAGS) $(PROT) lber.h $(LDAP_INCLUDEDIR)
+ifneq ($(LDAP_NO_LIBLCACHE),1)
+ $(INSTALL) $(INSTALLFLAGS) $(PROT) lcache.h $(LDAP_INCLUDEDIR)
+endif
+
+ $(INSTALL) $(INSTALLFLAGS) $(PROT) ldap_ssl.h $(LDAP_INCLUDEDIR)
+
+install: $(LDAP_INCLUDEDIR) clientSDK FORCE
+ $(INSTALL) $(INSTALLFLAGS) $(PROT) disptmpl.h $(LDAP_INCLUDEDIR)
+ $(INSTALL) $(INSTALLFLAGS) $(PROT) srchpref.h $(LDAP_INCLUDEDIR)
+ $(INSTALL) $(INSTALLFLAGS) $(PROT) portable.h $(LDAP_INCLUDEDIR)
+
+depend: FORCE
+
+clean: FORCE
+ -$(RM) db.h sys btree.h extern.h mpool.h
+
+veryclean: clean
+
+FORCE:
diff --git a/ldap/include/Makefile.client b/ldap/include/Makefile.client
new file mode 100644
index 00000000..e2c7ffe4
--- /dev/null
+++ b/ldap/include/Makefile.client
@@ -0,0 +1,54 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+DEPTH = ../../..
+
+CHMOD = chmod
+RM = rm -f
+SED = sed
+
+HEADERS = \
+ disptmpl.h \
+ lber.h \
+ ldap.h \
+ srchpref.h \
+ $(NULL)
+
+include $(DEPTH)/config/rules.mk
+
+GARBAGE += sdkver.h dirver.h
+
+ETCDIR = $(DIST)/etc
+INCLUDEDIR = $(XPDIST)/public/ldap
+
+DIR_VERSION := 2.0
+DIRSDK_VERSION := 1.0
+
+ifeq ($(OS_ARCH), WINNT)
+# Is this correct?
+DIRVER_PATH = $(DEPTH)/netsite/ldap/build
+else
+DIRVER_PATH = $(DIST)/bin
+endif
+
+DIRVER_PROG = $(DIRVER_PATH)/dirver$(BIN_SUFFIX)
+
+###########################################################################
+
+all export:: sdkver.h dirver.h FORCE
+ $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR)
+ $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(DIST)/include
+
+sdkver.h: $(DIRVER_PROG)
+ @$< $(DIRSDK_VERSION) UseSystemDate $@
+
+dirver.h: $(DIRVER_PROG)
+ @$< $(DIR_VERSION) UseSystemDate $@
+
+install:: export
+
+FORCE:
diff --git a/ldap/include/avl.h b/ldap/include/avl.h
new file mode 100644
index 00000000..4b11d5ae
--- /dev/null
+++ b/ldap/include/avl.h
@@ -0,0 +1,67 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/* avl.h - avl tree definitions */
+/*
+ * Copyright (c) 1993 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 _AVL
+#define _AVL
+
+/*
+ * this structure represents a generic avl tree node.
+ */
+
+typedef struct avlnode {
+ caddr_t avl_data;
+ signed char avl_bf;
+ struct avlnode *avl_left;
+ struct avlnode *avl_right;
+} Avlnode;
+
+#define NULLAVL ((Avlnode *) NULL)
+
+/* balance factor values */
+#define LH -1
+#define EH 0
+#define RH 1
+
+/* avl routines */
+#define avl_getone(x) (x == 0 ? 0 : (x)->avl_data)
+#define avl_onenode(x) (x == 0 || ((x)->avl_left == 0 && (x)->avl_right == 0))
+extern int avl_insert();
+extern caddr_t avl_delete();
+extern caddr_t avl_find();
+extern caddr_t avl_getfirst();
+extern caddr_t avl_getnext();
+extern int avl_dup_error();
+extern int avl_apply();
+extern int avl_free();
+
+/* apply traversal types */
+#define AVL_PREORDER 1
+#define AVL_INORDER 2
+#define AVL_POSTORDER 3
+/* what apply returns if it ran out of nodes */
+#define AVL_NOMORE -6
+
+#ifndef _IFP
+#define _IFP
+typedef int (*IFP)();
+#endif
+
+caddr_t avl_find_lin( Avlnode *root, caddr_t data, IFP fcmp );
+
+#endif /* _AVL */
diff --git a/ldap/include/dblayer.h b/ldap/include/dblayer.h
new file mode 100644
index 00000000..92ab5144
--- /dev/null
+++ b/ldap/include/dblayer.h
@@ -0,0 +1,7 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+/* This file is no longer used */
diff --git a/ldap/include/dirlite_strings.h b/ldap/include/dirlite_strings.h
new file mode 100644
index 00000000..8cc36920
--- /dev/null
+++ b/ldap/include/dirlite_strings.h
@@ -0,0 +1,62 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/* dirlite_strings.h - strings used for Directory Lite */
+#ifndef _DIRLITE_STRINGS_H_
+#define _DIRLITE_STRINGS_H_
+
+#define LITE_PRODUCT_NAME "restricted-mode directory"
+#define LITE_UPGRADE_BLURB "To gain access to this feature, you must upgrade to the full verson of the directory."
+
+#define LITE_GENERIC_ERR "cannot be configured in the " LITE_PRODUCT_NAME ". " LITE_UPGRADE_BLURB
+
+
+
+/* Directory Lite: Error Strings related to configuring replication */
+#define LITE_CHANGELOG_DIR_ERR "Error: changelog cannot be configured in DirectoryLite."
+#define LITE_CHANGELOG_SUFFIX_ERR "Error: changelogsuffix cannot be configured in DirectoryLite."
+#define LITE_CHANGELOG_MAXAGE_ERR "Error: changelogmaxage cannot be configured in DirectoryLite."
+#define LITE_CHANGELOG_MAXENTRIES_ERR "Error: changelogmaxentries cannot be configured in DirectoryLite."
+#define LITE_REPLICATIONDN_ERR "Error: replicationdn cannot be configured in DirectoryLite."
+#define LITE_REPLICATIONPW_ERR "Error: replicationpw cannot be configured in DirectoryLite."
+
+
+
+/* Directory Lite: Error Strings related to configurating referrals */
+#define LITE_DEFAULT_REFERRAL_ERR "Error: Referrals are disabled in the " LITE_PRODUCT_NAME ", The defaultreferral " LITE_GENERIC_ERR
+
+#define LITE_REFERRAL_MODE_ERR "Error: Referrals are disabled in the " LITE_PRODUCT_NAME ", The referralmode " LITE_GENERIC_ERR
+
+/* Directory Lite: Error Strings related to configuring password policy */
+#define LITE_PW_EXP_ERR "Error: password policy is disabled in the " LITE_PRODUCT_NAME ", pw_exp " LITE_GENERIC_ERR
+
+/* all plugins which need to be used for Directory Lite must use this as their vendor string */
+#define PLUGIN_MAGIC_VENDOR_STR "Netscape Communications Corp."
+
+/* plugins which contain this substring in their pluginid will not be aprroved in DS Lite */
+#define LITE_NTSYNCH_PLUGIN_ID_SUBSTR "nt-sync"
+
+/*Directory Lite: Error Strings related to configuring nt synch service */
+#define LITE_NTSYNCH_ERR "Error: NT Synch Service " LITE_GENERIC_ERR " nt_synch cannot be enabled."
+
+#define LITE_DISABLED_ATTRS_DN "cn=attributes,cn=options,cn=features,cn=config"
+#define LITE_DISABLED_MODULES_DN "cn=modules,cn=options,cn=features,cn=config"
+
+#define LITE_REPLICA_ERR "Error: Replication is disabled in the " LITE_PRODUCT_NAME ", replica " LITE_GENERIC_ERR
+
+/*Directory Lite: Error Strings related to configuring maxdescriptors */
+#define LITE_MAXDESCRIPTORS_ERR "Warning: The maximum number of concurent connections to the " LITE_PRODUCT_NAME " is 256. Maxdescriptors has a maximum value of 256, setting value for maxdescriptors to 256. To increase the maximum number of concurent connections, you must upgrade to the full version of the directory."
+#define SLAPD_LITE_MAXDESCRIPTORS 256
+
+/* on-line backup and restore */
+#define LITE_BACKUP_ERR "Error: The " LITE_PRODUCT_NAME " server must be in readonly mode before you can do this operation. You must upgrade to the full version of the directory to be able to perform online backup without first putting the server into readonly mode."
+
+/* Directory Lite: Error string related to enabling third party plugins */
+#define LITE_3RD_PARTY_PLUGIN_ERR "Error: Plugins written by third parties are disabled in " LITE_PRODUCT_NAME ". Plugin \"%s\" is disabled. " LITE_UPGRADE_BLURB
+
+#endif /* _DIRLITE_STRINGS_H_ */
+
+
+
diff --git a/ldap/include/disptmpl.h b/ldap/include/disptmpl.h
new file mode 100644
index 00000000..6fdbfc22
--- /dev/null
+++ b/ldap/include/disptmpl.h
@@ -0,0 +1,348 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/*
+ * 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
+ * 7 March 1994 by Mark C Smith
+ */
+
+#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 */
+
+#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) & 0xFF000000L )
+#define LDAP_GET_SYN_OPTIONS( syid ) ((syid) & 0x00FF0000L )
+
+
+/*
+ * 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
+
+
+/*
+ * 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 */
+
+
+
+/*
+ * 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 );
+
+LDAP_API(char *)
+LDAP_CALL
+ldap_tmplerr2string( int err );
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _DISPTMPL_H */
diff --git a/ldap/include/ldaplog.h b/ldap/include/ldaplog.h
new file mode 100644
index 00000000..3d4a6fb1
--- /dev/null
+++ b/ldap/include/ldaplog.h
@@ -0,0 +1,84 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+#ifndef _LDAPLOG_H
+#define _LDAPLOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LDAP_DEBUG_TRACE 0x00001 /* 1 */
+#define LDAP_DEBUG_PACKETS 0x00002 /* 2 */
+#define LDAP_DEBUG_ARGS 0x00004 /* 4 */
+#define LDAP_DEBUG_CONNS 0x00008 /* 8 */
+#define LDAP_DEBUG_BER 0x00010 /* 16 */
+#define LDAP_DEBUG_FILTER 0x00020 /* 32 */
+#define LDAP_DEBUG_CONFIG 0x00040 /* 64 */
+#define LDAP_DEBUG_ACL 0x00080 /* 128 */
+#define LDAP_DEBUG_STATS 0x00100 /* 256 */
+#define LDAP_DEBUG_STATS2 0x00200 /* 512 */
+#define LDAP_DEBUG_SHELL 0x00400 /* 1024 */
+#define LDAP_DEBUG_PARSE 0x00800 /* 2048 */
+#define LDAP_DEBUG_HOUSE 0x01000 /* 4096 */
+#define LDAP_DEBUG_REPL 0x02000 /* 8192 */
+#define LDAP_DEBUG_ANY 0x04000 /* 16384 */
+#define LDAP_DEBUG_CACHE 0x08000 /* 32768 */
+#define LDAP_DEBUG_PLUGIN 0x10000 /* 65536 */
+#define LDAP_DEBUG_TIMING 0x20000 /*131072 */
+#define LDAP_DEBUG_ACLSUMMARY 0x40000 /*262144 */
+
+#define LDAP_DEBUG_ALL_LEVELS 0xFFFFF
+
+/* debugging stuff */
+/* Disable by default */
+#define LDAPDebug( level, fmt, arg1, arg2, arg3 )
+#define LDAPDebugLevelIsSet( level ) (0)
+
+#ifdef LDAP_DEBUG
+# undef LDAPDebug
+# undef LDAPDebugLevelIsSet
+
+/* SLAPD_LOGGING should not be on for WINSOCK (16-bit Windows) */
+# if defined(SLAPD_LOGGING)
+# ifdef _WIN32
+# ifndef DONT_DECLARE_SLAPD_LDAP_DEBUG /* see libglobs.c for info */
+ extern __declspec(dllimport) int slapd_ldap_debug;
+# endif /* DONT_DECLARE_SLAPD_LDAP_DEBUG */
+# define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \
+ { \
+ if ( *module_ldap_debug & level ) { \
+ slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \
+ } \
+ }
+# define LDAPDebugLevelIsSet( level ) (0 != (*module_ldap_debug & level))
+# else /* Not _WIN32 */
+ extern int slapd_ldap_debug;
+# define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \
+ { \
+ if ( slapd_ldap_debug & level ) { \
+ slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \
+ } \
+ }
+# define LDAPDebugLevelIsSet( level ) (0 != (slapd_ldap_debug & level))
+# endif /* Win32 */
+# else /* no SLAPD_LOGGING */
+ extern void ber_err_print( char * );
+ extern int slapd_ldap_debug;
+# define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \
+ if ( slapd_ldap_debug & level ) { \
+ char msg[256]; \
+ sprintf( msg, fmt, arg1, arg2, arg3 ); \
+ ber_err_print( msg ); \
+ }
+# define LDAPDebugLevelIsSet( level ) (0 != (slapd_ldap_debug & level))
+# endif /* SLAPD_LOGGING */
+#endif /* LDAP_DEBUG */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LDAP_H */
diff --git a/ldap/include/ldaprot.h b/ldap/include/ldaprot.h
new file mode 100644
index 00000000..ae4042d4
--- /dev/null
+++ b/ldap/include/ldaprot.h
@@ -0,0 +1,167 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+#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
+ */
+
+/* general stuff */
+#define LDAP_TAG_MESSAGE 0x30L /* tag is 16 + constructed bit */
+#define OLD_LDAP_TAG_MESSAGE 0x10L /* forgot the constructed bit */
+#define LDAP_TAG_MSGID 0x02L /* INTEGER */
+#define LDAP_TAG_LDAPDN 0x04L /* OCTET STRING */
+#define LDAP_TAG_CONTROLS 0xa0L /* context specific + constructed + 0 */
+#define LDAP_TAG_REFERRAL 0xa3L /* context specific + constructed */
+#define LDAP_TAG_NEWSUPERIOR 0x80L /* context specific + primitive */
+#define LDAP_TAG_MRA_OID 0x81L /* context specific + primitive */
+#define LDAP_TAG_MRA_TYPE 0x82L /* context specific + primitive */
+#define LDAP_TAG_MRA_VALUE 0x83L /* context specific + primitive */
+#define LDAP_TAG_MRA_DNATTRS 0x84L /* context specific + primitive */
+#define LDAP_TAG_EXOP_REQ_OID 0x80L /* context specific + primitive */
+#define LDAP_TAG_EXOP_REQ_VALUE 0x81L /* context specific + primitive */
+#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 */
+#define LDAP_TAG_SK_REVERSE 0x81L /* context specific + primitive */
+#define LDAP_TAG_SR_ATTRTYPE 0x80L /* context specific + primitive */
+#define LDAP_TAG_SASL_RES_CREDS 0x87L /* context specific + primitive */
+#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_PWP_WARNING 0xA0 /* context specific + constructed + 0 */
+#define LDAP_TAG_PWP_SECSLEFT 0x80L /* context specific + primitive */
+#define LDAP_TAG_PWP_GRCLOGINS 0x81L /* context specific + primitive + 1 */
+#define LDAP_TAG_PWP_ERROR 0x81L /* context specific + primitive + 1 */
+
+/* possible operations a client can invoke */
+#define LDAP_REQ_BIND 0x60L /* application + constructed */
+#define LDAP_REQ_UNBIND 0x42L /* application + primitive */
+#define LDAP_REQ_SEARCH 0x63L /* application + constructed */
+#define LDAP_REQ_MODIFY 0x66L /* application + constructed */
+#define LDAP_REQ_ADD 0x68L /* application + constructed */
+#define LDAP_REQ_DELETE 0x4aL /* application + primitive */
+#define LDAP_REQ_MODRDN 0x6cL /* application + constructed */
+#define LDAP_REQ_MODDN 0x6cL /* application + constructed */
+#define LDAP_REQ_RENAME 0x6cL /* application + constructed */
+#define LDAP_REQ_COMPARE 0x6eL /* application + constructed */
+#define LDAP_REQ_ABANDON 0x50L /* application + primitive */
+#define LDAP_REQ_EXTENDED 0x77L /* application + constructed */
+
+/* version 3.0 compatibility stuff */
+#define LDAP_REQ_UNBIND_30 0x62L
+#define LDAP_REQ_DELETE_30 0x6aL
+#define LDAP_REQ_ABANDON_30 0x70L
+
+/*
+ * 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
+
+/* 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
+
+/* 3.0 compatibility filter types */
+#define LDAP_FILTER_PRESENT_30 0xa7L /* context specific + constructed */
+
+/* filter types */
+#define LDAP_FILTER_AND 0xa0L /* context specific + constructed */
+#define LDAP_FILTER_OR 0xa1L /* context specific + constructed */
+#define LDAP_FILTER_NOT 0xa2L /* context specific + constructed */
+#define LDAP_FILTER_EQUALITY 0xa3L /* context specific + constructed */
+#define LDAP_FILTER_SUBSTRINGS 0xa4L /* context specific + constructed */
+#define LDAP_FILTER_GE 0xa5L /* context specific + constructed */
+#define LDAP_FILTER_LE 0xa6L /* context specific + constructed */
+#define LDAP_FILTER_PRESENT 0x87L /* context specific + primitive */
+#define LDAP_FILTER_APPROX 0xa8L /* context specific + constructed */
+#define LDAP_FILTER_EXTENDED 0xa9L /* context specific + constructed */
+
+/* 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 */
+#define LDAP_SUBSTRING_ANY 0x81L /* context specific */
+#define LDAP_SUBSTRING_FINAL 0x82L /* context specific */
+
+/* extended filter component types */
+#define LDAP_FILTER_EXTENDED_OID 0x81L /* context specific */
+#define LDAP_FILTER_EXTENDED_TYPE 0x82L /* context specific */
+#define LDAP_FILTER_EXTENDED_VALUE 0x83L /* context specific */
+#define LDAP_FILTER_EXTENDED_DNATTRS 0x84L /* context specific */
+
+/* 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
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _LDAPROT_H */
diff --git a/ldap/include/ldbm.h b/ldap/include/ldbm.h
new file mode 100644
index 00000000..2221071b
--- /dev/null
+++ b/ldap/include/ldbm.h
@@ -0,0 +1,380 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/* ldbm.h - ldap dbm compatibility routine header file */
+
+#error "Hmm, shoudn't be here"
+/* Deprecated header, why are you including it ??? */
+
+#if 1
+
+#ifndef _LDBM_H_
+#define _LDBM_H_
+
+/* define LDAP_USE_DB185 to get the old db library, otherwise, use db2.0 */
+#ifndef LDAP_USE_DB185
+#define LDAP_USE_DB20
+#endif
+
+#ifdef LDBM_USE_GDBM
+
+/*****************************************************************
+ * *
+ * use gdbm if possible *
+ * *
+ *****************************************************************/
+
+#include <gdbm.h>
+
+typedef datum Datum;
+
+typedef GDBM_FILE LDBM;
+
+extern gdbm_error gdbm_errno;
+
+/* for ldbm_open */
+#define LDBM_READER GDBM_READER
+#define LDBM_WRITER GDBM_WRITER
+#define LDBM_WRCREAT GDBM_WRCREAT
+#define LDBM_NEWDB GDBM_NEWDB
+#define LDBM_FAST GDBM_FAST
+
+#define LDBM_SUFFIX ".gdbm"
+
+/* for ldbm_insert */
+#define LDBM_INSERT GDBM_INSERT
+#define LDBM_REPLACE GDBM_REPLACE
+#define LDBM_SYNC 0x80000000
+
+#else /* end of gdbm */
+
+#ifdef LDBM_USE_DBHASH
+
+/*****************************************************************
+ * *
+ * use berkeley db hash package *
+ * *
+ *****************************************************************/
+
+#include <sys/types.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <db.h>
+
+typedef DBT Datum;
+#define dsize size
+#define dptr data
+
+typedef DB *LDBM;
+
+#define DB_TYPE DB_HASH
+
+/* for ldbm_open */
+#define LDBM_READER O_RDONLY
+#define LDBM_WRITER O_RDWR
+#define LDBM_WRCREAT (O_RDWR|O_CREAT)
+#define LDBM_NEWDB (O_RDWR|O_TRUNC|O_CREAT)
+#define LDBM_FAST 0
+
+#define LDBM_SUFFIX ".dbh"
+
+/* for ldbm_insert */
+#define LDBM_INSERT R_NOOVERWRITE
+#define LDBM_REPLACE 0
+#define LDBM_SYNC 0x80000000
+
+#else /* end of db hash */
+
+#ifdef LDBM_USE_DBBTREE
+
+/*****************************************************************
+ * *
+ * use berkeley db btree package *
+ * *
+ *****************************************************************/
+
+#ifndef LDAP_USE_DB20 /* old-db needed us to include these system headers first */
+#include <sys/types.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <errno.h>
+#endif
+
+#ifdef HPUX11
+#define __BIT_TYPES_DEFINED__
+typedef unsigned char u_int8_t;
+typedef unsigned int u_int32_t;
+typedef unsigned short u_int16_t;
+#endif
+#include <db.h>
+
+#define DB_TYPE DB_BTREE
+
+#define LDBM_ORDERED 1
+
+#ifdef LDAP_USE_DB20
+
+/* pull in parts of the new interface , this comes from dblayer.h */
+
+typedef struct _tag_dblayer_session{
+ DB_ENV db_env;
+} *dblayer_session, dblayer_session_struct;
+
+
+/* for ldbm_insert */
+#define LDBM_INSERT DB_NOOVERWRITE
+#define LDBM_REPLACE 0 /* Db2.0 default is to replace */
+#define LDBM_SYNC 0x80000000
+
+typedef DBT Datum;
+#define dsize size
+#define dptr data
+
+typedef struct _ldbm {
+ DB *pReal_DB;
+ DBC *pCursor;
+} _ldbmstruct, *LDBM;
+
+/* for ldbm_open */
+#define LDBM_READER DB_RDONLY
+#define LDBM_WRITER 0
+#define LDBM_WRCREAT DB_CREATE
+#define LDBM_NEWDB (DB_TRUNCATE | DB_CREATE)
+#define LDBM_FAST 0
+
+#define LDBM_SUFFIX ".db2"
+#else /* DB 1.85 */
+
+/* for ldbm_insert */
+#define LDBM_INSERT R_NOOVERWRITE
+#define LDBM_REPLACE 0
+#define LDBM_SYNC 0x80000000
+
+typedef DBT Datum;
+#define dsize size
+#define dptr data
+
+typedef DB *LDBM;
+/* for ldbm_open */
+#define LDBM_READER O_RDONLY
+#define LDBM_WRITER O_RDWR
+#define LDBM_WRCREAT (O_RDWR|O_CREAT)
+#define LDBM_NEWDB (O_RDWR|O_TRUNC|O_CREAT)
+#define LDBM_FAST 0
+
+#define LDBM_SUFFIX ".dbb"
+#endif /* LDAP_USE_DB20 */
+
+#else /* end of db btree */
+
+#ifdef LDBM_USE_NDBM
+
+/*****************************************************************
+ * *
+ * if none of the above use ndbm, the standard unix thing *
+ * *
+ *****************************************************************/
+
+#include <ndbm.h>
+#ifndef O_RDONLY
+#include <fcntl.h>
+#endif
+
+typedef datum Datum;
+
+typedef DBM *LDBM;
+
+/* for ldbm_open */
+#define LDBM_READER O_RDONLY
+#define LDBM_WRITER O_WRONLY
+#define LDBM_WRCREAT (O_RDWR|O_CREAT)
+#define LDBM_NEWDB (O_RDWR|O_TRUNC|O_CREAT)
+#define LDBM_FAST 0
+
+#define LDBM_SUFFIX ".ndbm"
+
+/* for ldbm_insert */
+#define LDBM_INSERT DBM_INSERT
+#define LDBM_REPLACE DBM_REPLACE
+#define LDBM_SYNC 0
+
+#else /* end of ndbm */
+
+#ifdef LDBM_USE_CISAM
+
+/*****************************************************************
+ * *
+ * use CISAM db package *
+ * *
+ *****************************************************************/
+
+#include <sys/types.h>
+#include <sys/errno.h>
+#include <limits.h>
+#include <fcntl.h>
+#include "isam.h"
+
+extern int errno;
+
+struct datum {
+ void *dptr; /* data */
+ size_t dsize; /* data length */
+};
+
+typedef struct datum Datum;
+
+struct ldbm {
+ int fd; /* all callers expect a ptr */
+ int cur_recnum; /* for reading sequentially */
+};
+
+typedef struct ldbm *LDBM;
+
+/* for ldbm_open */
+#define LDBM_READER (ISINPUT | ISVARLEN | ISMANULOCK)
+#define LDBM_WRITER (ISINOUT | ISVARLEN | ISMANULOCK)
+#define LDBM_WRCREAT (ISINOUT | ISVARLEN | ISMANULOCK | ISEXCLLOCK)
+#define LDBM_NEWDB (ISINOUT | ISVARLEN | ISMANULOCK | ISEXCLLOCK)
+#define LDBM_FAST 0
+
+#define LDBM_SUFFIX ""
+#define LDBM_ORDERED 1
+
+/* for ldbm_insert */
+#define LDBM_INSERT 1
+#define LDBM_REPLACE 0
+#define LDBM_SYNC 0x80000000
+
+#else /* end of cisam */
+
+#ifdef LDBM_USE_TRIO
+
+/*****************************************************************
+ * *
+ * use C-Index/II from Trio *
+ * *
+ *****************************************************************/
+
+#include <sys/types.h>
+#include <sys/errno.h>
+#include <limits.h>
+#include <fcntl.h>
+#include "cndx.h"
+
+#define CRDCREAT 0x100
+
+extern int errno;
+
+struct datum {
+ void *dptr; /* data */
+ size_t dsize; /* data length */
+};
+
+typedef struct datum Datum;
+
+typedef CFILE *LDBM;
+
+/* for ldbm_open */
+#define LDBM_READER (CRDONLY)
+#define LDBM_WRITER (CRDWRITE)
+#define LDBM_WRCREAT (CRDWRITE | CRDCREAT)
+#define LDBM_NEWDB (CRDWRITE | CRDCREAT)
+#define LDBM_FAST 0
+
+#define LDBM_SUFFIX ".c2i"
+#define LDBM_ORDERED 1
+
+/* for ldbm_insert */
+#define LDBM_INSERT 1
+#define LDBM_REPLACE 0
+#define LDBM_SYNC 0x80000000
+
+
+#else /* end of trio */
+
+#ifdef LDBM_USE_CTREE
+
+/*****************************************************************
+ * *
+ * use Faircom Ctree db package *
+ * *
+ *****************************************************************/
+
+#include <sys/types.h>
+#include <sys/errno.h>
+#include <limits.h>
+#include <fcntl.h>
+
+#include "ctstdr.h"
+#include "ctoptn.h"
+#include "ctaerr.h"
+#include "ctdecl.h"
+#include "cterrc.h"
+
+extern int errno;
+
+struct datum {
+ void *dptr; /* data */
+ size_t dsize; /* data length */
+};
+
+typedef struct datum Datum;
+typedef IFIL *LDBM;
+
+/* for ldbm_open */
+#define LDBM_READER 0
+#define LDBM_WRITER 0
+#define LDBM_WRCREAT 1
+#define LDBM_NEWDB 1
+#define LDBM_FAST 0
+
+#define LDBM_SUFFIX ""
+#define LDBM_ORDERED 1
+
+/* for ldbm_insert */
+#define LDBM_INSERT 1
+#define LDBM_REPLACE 0
+#define LDBM_SYNC 0x80000000
+
+#endif /* ctree */
+#endif /* trio */
+#endif /* cisam */
+#endif /* ndbm */
+#endif /* db hash */
+#endif /* db btree */
+#endif /* gdbm */
+
+/*
+ * name: file name without the suffix
+ * rw: read/write flags
+ * mode: this has the desired permissions mode on the file
+ * dbcachesize: advisory cache size in bytes
+ */
+LDBM ldbm_open( char *name, int rw, int mode, int dbcachesize );
+#ifdef LDAP_USE_DB20
+/* This is a stopgap measure to allow us to associate a session with ldbm_ calls */
+LDBM ldbm_open2( dblayer_session session, char *name, int rw, int mode);
+/* These are stolen from beta2's dblayer.h */
+int dblayer_session_open(char *home_dir, char* log_dir, char* temp_dir, int cachesize, dblayer_session session) ;
+int dblayer_session_terminate(dblayer_session session) ;
+#endif
+int ldbm_close( LDBM ldbm );
+void ldbm_sync( LDBM ldbm );
+void ldbm_datum_free( LDBM ldbm, Datum data );
+Datum ldbm_datum_dup( LDBM ldbm, Datum data );
+Datum ldbm_fetch( LDBM ldbm, Datum key );
+int ldbm_store( LDBM ldbm, Datum key, Datum data, int flags );
+int ldbm_delete( LDBM ldbm, Datum key );
+Datum ldbm_firstkey( LDBM ldbm );
+Datum ldbm_nextkey( LDBM ldbm, Datum key );
+Datum ldbm_prevkey( LDBM ldbm, Datum key );
+Datum ldbm_lastkey( LDBM ldbm );
+Datum ldbm_cursorkey( LDBM ldbm, Datum key );
+int ldbm_errno( LDBM ldbm );
+
+#endif /* _ldbm_h_ */
+
+#endif /* 0 */
diff --git a/ldap/include/ldif.h b/ldap/include/ldif.h
new file mode 100644
index 00000000..5c154749
--- /dev/null
+++ b/ldap/include/ldif.h
@@ -0,0 +1,76 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/*
+ * 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 ldif_parse_line( char *line, char **type, char **value, int *vlen, char **errcode);
+char * ldif_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/ldap/include/litekey.h b/ldap/include/litekey.h
new file mode 100644
index 00000000..43dd0f4f
--- /dev/null
+++ b/ldap/include/litekey.h
@@ -0,0 +1,30 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/*
+ * Defines function used to determine the type of DS based on the
+ * key.
+ */
+#ifndef _LITEKEY_H
+#define _LITEKEY_H
+
+#include <dirlite_strings.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define DS_NORMAL_TYPE 0
+#define DS_LITE_TYPE 1
+
+int is_directory_lite ( char *path);
+int generate_directory_key( int type);
+int is_key_validNormalKey ( int key );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LITEKEY_H */
diff --git a/ldap/include/lthread.h b/ldap/include/lthread.h
new file mode 100644
index 00000000..8f24a08c
--- /dev/null
+++ b/ldap/include/lthread.h
@@ -0,0 +1,423 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/* lthread.h - ldap threads header file */
+
+#ifndef _LTHREAD_H
+#define _LTHREAD_H
+
+#if defined( THREAD_SUNOS4_LWP )
+/***********************************
+ * *
+ * thread definitions for sunos4 *
+ * *
+ ***********************************/
+
+#define _THREAD
+
+#include <lwp/lwp.h>
+#include <lwp/stackdep.h>
+
+typedef void *(*VFP)();
+
+/* thread attributes and thread type */
+typedef int pthread_attr_t;
+typedef thread_t pthread_t;
+
+/* default attr states */
+#define pthread_mutexattr_default NULL
+#define pthread_condattr_default NULL
+
+/* thread state - joinable or not */
+#define PTHREAD_CREATE_JOINABLE 0
+#define PTHREAD_CREATE_DETACHED 1
+/* thread scope - who is in scheduling pool */
+#define PTHREAD_SCOPE_PROCESS 0
+#define PTHREAD_SCOPE_SYSTEM 1
+
+/* mutex attributes and mutex type */
+typedef int pthread_mutexattr_t;
+typedef mon_t pthread_mutex_t;
+
+/* mutex and condition variable scope - process or system */
+#define PTHREAD_SHARE_PRIVATE 0
+#define PTHREAD_SHARE_PROCESS 1
+
+/* condition variable attributes and condition variable type */
+typedef int pthread_condattr_t;
+typedef struct lwpcv {
+ int lcv_created;
+ cv_t lcv_cv;
+} pthread_cond_t;
+
+#else /* end sunos4 */
+
+#if defined( THREAD_SUNOS5_LWP )
+/***********************************
+ * *
+ * thread definitions for sunos5 *
+ * *
+ ***********************************/
+
+#define _THREAD
+
+#include <thread.h>
+#include <synch.h>
+
+typedef void *(*VFP)();
+
+/* sunos5 threads are preemptive */
+#define PTHREAD_PREEMPTIVE 1
+
+/* thread attributes and thread type */
+typedef int pthread_attr_t;
+typedef thread_t pthread_t;
+
+/* default attr states */
+#define pthread_mutexattr_default NULL
+#define pthread_condattr_default NULL
+
+/* thread state - joinable or not */
+#define PTHREAD_CREATE_JOINABLE 0
+#define PTHREAD_CREATE_DETACHED THR_DETACHED
+/* thread scope - who is in scheduling pool */
+#define PTHREAD_SCOPE_PROCESS 0
+#define PTHREAD_SCOPE_SYSTEM THR_BOUND
+
+/* mutex attributes and mutex type */
+typedef int pthread_mutexattr_t;
+typedef mutex_t pthread_mutex_t;
+
+/* mutex and condition variable scope - process or system */
+#define PTHREAD_SHARE_PRIVATE USYNC_THREAD
+#define PTHREAD_SHARE_PROCESS USYNC_PROCESS
+
+/* condition variable attributes and condition variable type */
+typedef int pthread_condattr_t;
+typedef cond_t pthread_cond_t;
+
+#else /* end sunos5 */
+
+#if defined( THREAD_MIT_PTHREADS )
+/***********************************
+ * *
+ * definitions for mit pthreads *
+ * *
+ ***********************************/
+
+#define _THREAD
+
+#include <pthread.h>
+
+#else /* end mit pthreads */
+
+#if defined( THREAD_AIX_PTHREADS )
+/***********************************
+ * *
+ * definitions for aix pthreads *
+ * *
+ ***********************************/
+
+#define _THREAD
+
+#include <pthread.h>
+
+typedef void *(*VFP)(void *);
+
+/* thread state - joinable or not */
+#define PTHREAD_CREATE_JOINABLE 0
+
+/* default attr states */
+#define pthread_mutexattr_default NULL
+#define pthread_condattr_default NULL
+
+#else /* aix pthreads */
+
+#if defined( THREAD_HP_DCE_PTHREADS )
+/**************************************
+ * *
+ * definitions for HP dce pthreads *
+ * *
+ **************************************/
+
+#define _THREAD
+typedef void *(*VFP)();
+
+#include <pthread.h>
+
+/* dce threads are preemptive */
+#define PTHREAD_PREEMPTIVE 1
+
+/* pthread_kill() is a noop on HP */
+#define PTHREAD_KILL_IS_NOOP 1
+
+/* thread state - joinable or not */
+#define PTHREAD_CREATE_JOINABLE 0
+#define PTHREAD_CREATE_DETACHED 1
+
+#define pthread_attr_init( a ) pthread_attr_create( a )
+#define pthread_attr_destroy( a ) pthread_attr_delete( a )
+#define pthread_attr_setdetachstate( a, b ) \
+ pthread_attr_setdetach_np( a, b )
+/*
+ * HP's DCE threads implementation passes a (pthread_attr_t *)
+ * for the second argument. So, we need to fake things a bit.
+ * hpdce_pthread_create_detached() is in thread.c. Note that we
+ * create threads and detach them. If you need to create a joinable
+ * thread, you need to call hpdce_pthread_create_joinable() directly.
+ */
+#define pthread_create( a, b, c, d ) \
+ hpdce_pthread_create_detached( a, b, c, d )
+
+int
+hpdce_pthread_create_joinable( pthread_t *tid, pthread_attr_t *attr,
+ VFP func, void *arg );
+int hpdce_pthread_create_detached( pthread_t *tid, pthread_attr_t *attr,
+ VFP func, void *arg );
+#else /* HP dce pthreads */
+
+#if defined( THREAD_DCE_PTHREADS )
+/***********************************
+ * *
+ * definitions for dce pthreads *
+ * *
+ ***********************************/
+
+#define _THREAD
+typedef void *(*VFP)();
+
+#include <pthread.h>
+
+/* dce threads are preemptive */
+#define PTHREAD_PREEMPTIVE 1
+
+/* thread state - joinable or not */
+#ifndef PTHREAD_CREATE_JOINABLE
+#define PTHREAD_CREATE_JOINABLE 0
+#endif
+#ifndef PTHREAD_CREATE_DETACHED
+#define PTHREAD_CREATE_DETACHED 1
+#endif
+
+#define pthread_attr_init( a ) pthread_attr_create( a )
+#define pthread_attr_destroy( a ) pthread_attr_delete( a )
+#define pthread_attr_setdetachstate( a, b ) \
+ pthread_attr_setdetach_np( a, b )
+#if defined( OSF1 )
+/* pthread_create's second parameter is passed by value, not by reference.
+ * To work around this, call another function instead:
+ */
+#define pthread_create( a, b, c, d ) std_pthread_create( a, b, c, d )
+extern int
+std_pthread_create (pthread_t *tid,
+ pthread_attr_t *attr,
+ pthread_startroutine_t func,
+ pthread_addr_t arg); /* defined in thread.c */
+
+/* OSF1 doesn't support pthread_kill() */
+#define PTHREAD_KILL_IS_NOOP 1
+
+#endif /* OSF1 */
+
+#else /* dce pthreads */
+
+#if defined( THREAD_SGI_SPROC )
+/***********************************
+ * *
+ * thread definitions for sgi irix *
+ * *
+ ***********************************/
+
+#define _THREAD
+
+#include <sys/types.h>
+#include <sys/signal.h>
+#include <sys/procset.h>
+#include <sys/prctl.h>
+#include <ulocks.h>
+
+typedef void *(*VFP)(void *);
+
+/* sgi threads are preemptive */
+#define PTHREAD_PREEMPTIVE 1
+
+/* thread attributes and thread type */
+typedef int pthread_attr_t;
+typedef pid_t pthread_t;
+
+/* default attr states */
+#define pthread_mutexattr_default 0
+#define pthread_condattr_default 0
+
+/* thread state - joinable or not */
+#define PTHREAD_CREATE_JOINABLE 0
+#define PTHREAD_CREATE_DETACHED 1
+/* thread scope - who is in scheduling pool */
+#define PTHREAD_SCOPE_PROCESS 0
+#define PTHREAD_SCOPE_SYSTEM 1
+
+/* mutex attributes and mutex type */
+typedef int pthread_mutexattr_t;
+typedef int pthread_mutex_t;
+
+/* mutex and condition variable scope - process or system */
+#define PTHREAD_SHARE_PRIVATE 0
+#define PTHREAD_SHARE_PROCESS 1
+
+/* condition variable attributes and condition variable type */
+typedef int pthread_condattr_t;
+struct irix_cv_waiter {
+ pid_t icvw_pid;
+ struct irix_cv_waiter *icvw_next;
+};
+typedef struct irix_cv {
+ pthread_mutex_t icv_mutex;
+ pthread_mutex_t *icv_waitermutex;
+ struct irix_cv_waiter *icv_waiterq;
+} pthread_cond_t;
+
+#else
+
+#if defined( WIN32_KERNEL_THREADS )
+
+/***********************************
+ * *
+ * thread definitions for Win32 *
+ * *
+ ***********************************/
+
+#define _THREAD
+
+#include <windows.h>
+#include <process.h>
+#include "ldap.h"
+#include "ldaplog.h"
+
+typedef void (*VFP)(void *);
+
+/* Win32 threads are preemptive */
+#define PTHREAD_PREEMPTIVE 1
+
+/* thread attributes and thread type */
+typedef int pthread_attr_t;
+typedef HANDLE pthread_t;
+
+/* default attr states */
+#define pthread_mutexattr_default 0
+#define pthread_condattr_default 0
+
+/* thread state - joinable or not */
+#define PTHREAD_CREATE_JOINABLE 0
+#define PTHREAD_CREATE_DETACHED 1
+/* thread scope - who is in scheduling pool */
+#define PTHREAD_SCOPE_PROCESS 0
+#define PTHREAD_SCOPE_SYSTEM 1
+
+/* mutex attributes and mutex type */
+typedef int pthread_mutexattr_t;
+typedef HANDLE pthread_mutex_t;
+
+/* mutex and condition variable scope - process or system */
+#define PTHREAD_SHARE_PRIVATE 0
+#define PTHREAD_SHARE_PROCESS 1
+
+/* condition variable attributes and condition variable type */
+typedef int pthread_condattr_t;
+
+/* simulated condition variable */
+struct win32_cv_waiter {
+ pthread_t icvw_pthread;
+ struct win32_cv_waiter *icvw_next;
+};
+typedef struct win32_cv {
+ pthread_mutex_t icv_mutex;
+ pthread_mutex_t *icv_waitermutex;
+ struct win32_cv_waiter *icv_waiterq;
+} pthread_cond_t;
+
+#endif /* NATIVE_WIN32_THREADS */
+#endif /* sgi sproc */
+#endif /* dce pthreads */
+#endif /* hp dce pthreads */
+#endif /* aix pthreads */
+#endif /* mit pthreads */
+#endif /* sunos5 */
+#endif /* sunos4 */
+
+#ifndef _THREAD
+
+/***********************************
+ * *
+ * thread definitions for no *
+ * underlying library support *
+ * *
+ ***********************************/
+
+typedef void *(*VFP)();
+
+/* thread attributes and thread type */
+typedef int pthread_attr_t;
+typedef int pthread_t;
+
+/* default attr states */
+#define pthread_mutexattr_default NULL
+#define pthread_condattr_default NULL
+
+/* thread state - joinable or not */
+#define PTHREAD_CREATE_JOINABLE 0
+#define PTHREAD_CREATE_DETACHED 0
+/* thread scope - who is in scheduling pool */
+#define PTHREAD_SCOPE_PROCESS 0
+#define PTHREAD_SCOPE_SYSTEM 0
+
+/* mutex attributes and mutex type */
+typedef int pthread_mutexattr_t;
+typedef int pthread_mutex_t;
+
+/* mutex and condition variable scope - process or system */
+#define PTHREAD_SHARE_PRIVATE 0
+#define PTHREAD_SHARE_PROCESS 0
+
+/* condition variable attributes and condition variable type */
+typedef int pthread_condattr_t;
+typedef int pthread_cond_t;
+
+#endif /* no threads support */
+
+/* POSIX standard pthread function declarations: */
+
+int pthread_attr_init( pthread_attr_t *attr );
+int pthread_attr_destroy( pthread_attr_t *attr );
+int pthread_attr_getdetachstate( pthread_attr_t *attr, int *detachstate );
+int pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate );
+
+int pthread_create( pthread_t *tid, pthread_attr_t *attr, VFP func, void *arg );
+void pthread_yield();
+void pthread_exit();
+int pthread_kill( pthread_t tid, int sig );
+#if defined( hpux ) || defined( OSF1 ) || defined( AIXV4 ) /* <thread.h> declares pthread_join */
+#else
+int pthread_join( pthread_t tid, int *status );
+#endif
+
+#if defined( hpux ) || defined( OSF1 ) /* <thread.h> declares pthread_mutex_init */
+#else
+int pthread_mutex_init( pthread_mutex_t *mp, pthread_mutexattr_t *attr );
+#endif
+int pthread_mutex_destroy( pthread_mutex_t *mp );
+int pthread_mutex_lock( pthread_mutex_t *mp );
+int pthread_mutex_unlock( pthread_mutex_t *mp );
+int pthread_mutex_trylock( pthread_mutex_t *mp );
+
+#if defined( hpux ) || defined( OSF1 ) /* <thread.h> declares pthread_cond_init */
+#else
+int pthread_cond_init( pthread_cond_t *cv, pthread_condattr_t *attr );
+#endif
+int pthread_cond_destroy( pthread_cond_t *cv );
+int pthread_cond_wait( pthread_cond_t *cv, pthread_mutex_t *mp );
+int pthread_cond_signal( pthread_cond_t *cv );
+int pthread_cond_broadcast( pthread_cond_t *cv );
+
+#endif /* _LTHREAD_H */
diff --git a/ldap/include/ntslapdregparms.h b/ldap/include/ntslapdregparms.h
new file mode 100644
index 00000000..ea1ff559
--- /dev/null
+++ b/ldap/include/ntslapdregparms.h
@@ -0,0 +1,41 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/******************************************************
+ *
+ *
+ * ntslapdregparms.h - NT Registry keys for Slapd.
+ *
+ ******************************************************/
+
+#if defined( _WIN32 )
+
+#if !defined( _NTSLAPDREGPARMS_H_ )
+#define _NTSLAPDREGPARMS_H_
+
+#define COMPANY_KEY "SOFTWARE\\Netscape"
+#define COMPANY_NAME "Netscape Communications Corp."
+#define PROGRAM_GROUP_NAME "Netscape"
+#define PRODUCT_NAME "slapd"
+#define PRODUCT_BIN "ns-slapd"
+#define SLAPD_EXE "slapd.exe"
+#define SERVICE_EXE SLAPD_EXE
+#define SLAPD_CONF "slapd.conf"
+#define MAGNUS_CONF SLAPD_CONF
+#define SLAPD_DONGLE_FILE "password.dng"
+#define DONGLE_FILE_NAME SLAPD_DONGLE_FILE
+#define PRODUCT_VERSION "1.0"
+#define EVENTLOG_APPNAME "NetscapeSlapd"
+#define DIRECTORY_SERVICE_PREFIX "Netscape Directory Server "
+#define SERVICE_PREFIX DIRECTORY_SERVICE_PREFIX
+#define CONFIG_PATH_KEY "ConfigurationPath"
+#define EVENTLOG_MESSAGES_KEY "EventMessageFile"
+#define EVENT_LOG_KEY "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application"
+#define ADMIN_REGISTRY_ROOT_KEY "Admin Server"
+#define SLAPD_REGISTRY_ROOT_KEY "Slapd Server"
+#define PRODUCT_KEY SLAPD_REGISTRY_ROOT_KEY
+#endif /* _NTSLAPDREGPARMS_H_ */
+
+#endif /* _WIN32 */
diff --git a/ldap/include/ntwatchdog.h b/ldap/include/ntwatchdog.h
new file mode 100644
index 00000000..ced95daa
--- /dev/null
+++ b/ldap/include/ntwatchdog.h
@@ -0,0 +1,68 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/******************************************************
+ *
+ *
+ * ntwatchdog.h - Defs for NT Watchdog Service.
+ *
+ ******************************************************/
+
+#if defined( _WIN32 )
+
+#if !defined( _NTWATCHDOG_H_ )
+#define _NTWATCHDOG_H_
+
+#define FILE_PATHSEP '/'
+
+#define SLAPD_ROOT "SLAPD_ROOT" // environment variable holding server root path
+#define MORTALITY_KEY "MortalityTimeSecs"
+#define MINRAMFREE_KEY "MinRamFree"
+#define MINRAMTOTAL_KEY "MinRamTotal"
+#define MINRAMPERSERVER_KEY "MinRamPerServer"
+#define DEFAULT_MORTALITY_TIME 60 // seconds after startup up until server will NOT be restarted
+#define DEFAULT_KILL_TIME 600 // seconds to wait for httpd.exe to shutdown
+#define DEFAULT_CRON_TIME 60 // seconds to wait before rechecking cron.conf
+#define DEFAULT_RESTART_TIME 10 // seconds to wait before restarting server
+#define DEFAULT_MINRAMFREE 0 // KB free physical memory remaining
+#define DEFAULT_MINRAMTOTAL (30 * 1024) // KB free physical memory installed
+#define DEFAULT_MINRAMPERSERVER (15 * 1024) // KB free physical memory per server
+
+#define MSG_RESOURCES "Not enough physical memory to start server."
+
+// offsets for extra window bytes, used in Set/GetWindowLong()
+#define GWL_PROCESS_HANDLE (sizeof(LONG) * 0)
+#define GWL_PASSWORD_ADDR (sizeof(LONG) * 1)
+#define GWL_PASSWORD_LENGTH (sizeof(LONG) * 2)
+
+#define MAX_LINE 512
+#define MAX_PASSWORD 256
+#define MAX_TOKENNAME 50
+
+typedef struct PK11_PIN
+{
+ char TokenName[MAX_TOKENNAME];
+ int TokenLength;
+ char Password[MAX_PASSWORD];
+ int PasswordLength;
+}PK11_PIN;
+
+#define CLOSEHANDLE(X) \
+{ \
+ if(X) \
+ { \
+ CloseHandle(X); \
+ X = 0; \
+ } \
+}
+
+// in ntcron.c
+LPTHREAD_START_ROUTINE CRON_ThreadProc(HANDLE hevWatchDogExit);
+
+// in watchdog.c
+BOOL WD_SysLog(WORD fwEventType, DWORD IDEvent, char *szData);
+
+#endif /* _NTWATCHDOG_H_ */
+#endif /* _WIN32 */
diff --git a/ldap/include/portable.h b/ldap/include/portable.h
new file mode 100644
index 00000000..2934db6d
--- /dev/null
+++ b/ldap/include/portable.h
@@ -0,0 +1,380 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/*
+ * 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
+
+/*
+ * We use the internal regex on all systems now.
+ */
+#ifndef NEED_BSDREGEX
+#define NEED_BSDREGEX
+#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 ) || defined(Linux)
+#define SYSERRLIST_IN_STDIO
+#endif
+#endif
+
+/*
+ * for select()
+ */
+#if !defined(WINSOCK) && !defined(_WINDOWS) && !defined(macintosh)
+#if defined(hpux) || defined(LINUX2_0)
+#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))
+#define LDAP_CONNECT_MUST_NOT_BE_INTERRUPTED
+#endif
+
+
+/*
+ * Some DNS resolver implementations, such as the one built into
+ * Solaris <= 8, need to use one or more low numbered file
+ * descriptors internally (probably because they use a deficient
+ * implementation of stdio).
+ */
+#if defined(SOLARIS) || defined(IRIX)
+#define RESOLVER_NEEDS_LOW_FILE_DESCRIPTORS
+#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)
+#define GETHOSTBYNAME( n, r, b, l, e ) gethostbyname( n )
+#define 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(LINUX2_0)
+#define GETHOSTBYNAME( n, r, b, l, e ) gethostbyname( n )
+#elif defined(AIX)
+#define GETHOSTBYNAME_BUF_T struct hostent_data
+#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
+
+/*
+ * XXXmcs: GETHOSTBYADDR() is only defined for IRIX/SGI and Solaris for now.
+ */
+#if defined(sgi)
+#define GETHOSTBYADDR( a, al, t, h, b, bl, e ) \
+ gethostbyaddr( a, al, t )
+#elif defined(SOLARIS)
+#include <stdio.h> /* BUFSIZ */
+typedef char GETHOSTBYADDR_buf_t [BUFSIZ];
+#define GETHOSTBYADDR_BUF_T GETHOSTBYADDR_buf_t
+#define GETHOSTBYADDR( a, al, t, h, b, bl, e ) \
+ gethostbyaddr_r( a, al, t, h, b, bl, e )
+#endif
+
+
+#if defined(HPUX9) || defined(LINUX1_2) || defined(SUNOS4) || defined(SNI) || \
+ defined(SCOOS) || defined(BSDI) || defined(NCR) || \
+ defined(NEC) || ( defined(HPUX10) && !defined(_REENTRANT))
+#define CTIME( c, b, l ) ctime( c )
+#elif defined( hpux10 )
+#define CTIME( c, b, l ) nsldapi_compat_ctime_r( c, b, l )
+#elif defined( IRIX ) || defined(UNIXWARE) || defined(LINUX) \
+ || defined(OSF1V4) || defined(AIX) || defined(UnixWare) || defined (HPUX11)
+#define CTIME( c, b, l ) ctime_r( c, b )
+#elif defined( OSF1V3 )
+#define CTIME( c, b, l ) (ctime_r( c, b, l ) ? NULL : b)
+#else
+#define 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(LINUX2_0)
+/* strtok() is not MT safe, but it is okay to call here because used in mmt_protocol.xs which
+ has been moved in the tetframewrok */
+#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 */
+
+#ifdef SOLARIS
+#include <netinet/in.h>
+#include <arpa/inet.h> /* for inet_addr() */
+#endif /* SOLARIS */
+
+#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 LDAP_CALL 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
+ */
+#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 */
+
+#ifdef _WINDOWS
+
+#undef strcasecmp
+#define strcasecmp strcmpi
+#undef strncasecmp
+#define strncasecmp _strnicmp
+#define bzero(a, b) memset( a, 0, b )
+#define getpid _getpid
+#define ioctl ioctlsocket
+#undef sleep
+#define sleep(a) Sleep( a*1000 )
+
+#define EMSGSIZE WSAEMSGSIZE
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define EHOSTUNREACH WSAEHOSTUNREACH
+
+#if !defined(MAXPATHLEN)
+#define MAXPATHLEN _MAX_PATH
+#endif
+
+#endif
+
+#endif /* _PORTABLE_H */
diff --git a/ldap/include/proto-ntutil.h b/ldap/include/proto-ntutil.h
new file mode 100644
index 00000000..879387b3
--- /dev/null
+++ b/ldap/include/proto-ntutil.h
@@ -0,0 +1,79 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/******************************************************
+ *
+ *
+ * proto-ntutil.h - Prototypes for utility functions used
+ * throughout slapd on NT.
+ *
+ ******************************************************/
+#if defined( _WINDOWS )
+
+#ifndef _PROTO_NTUTIL
+#define _PROTO_NTUTIL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ *
+ * ntreg.c
+ *
+ */
+extern int SlapdGetRegSZ( LPTSTR lpszRegKey, LPSTR lpszValueName, LPTSTR lpszValue );
+extern void unixtodospath(char *szText);
+extern void dostounixpath(char *szText);
+
+
+/*
+ *
+ * getopt.c
+ *
+ */
+extern int getopt (int argc, char *const *argv, const char *optstring);
+extern char *optarg;
+/*
+ *
+ * ntevent.c
+ *
+ */
+extern BOOL MultipleInstances();
+extern BOOL SlapdIsAService();
+extern void InitializeSlapdLogging( LPTSTR lpszRegLocation, LPTSTR lpszEventLogName, LPTSTR lpszMessageFile );
+extern void ReportSlapdEvent(WORD wEventType, DWORD dwIdEvent, WORD wNumInsertStrings,
+ char *pszStrings);
+extern BOOL ReportSlapdStatusToSCMgr(
+ SERVICE_STATUS *serviceStatus,
+ SERVICE_STATUS_HANDLE serviceStatusHandle,
+ HANDLE Event,
+ DWORD dwCurrentState,
+ DWORD dwWin32ExitCode,
+ DWORD dwCheckPoint,
+ DWORD dwWaitHint);
+extern void WINAPI SlapdServiceCtrlHandler(DWORD dwOpcode);
+extern BOOL SlapdGetServerNameFromCmdline(char *szServerName, char *szCmdLine, int dirname);
+
+/*
+ *
+ * ntgetpassword.c
+ *
+ */
+#ifdef NET_SSL
+extern char *Slapd_GetPassword();
+#ifdef FORTEZZA
+extern char *Slapd_GetFortezzaPIN();
+#endif
+extern void CenterDialog(HWND hwndParent, HWND hwndDialog);
+#endif /* NET_SSL */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PROTO_NTUTIL */
+
+#endif /* _WINDOWS */
diff --git a/ldap/include/regex.h b/ldap/include/regex.h
new file mode 100644
index 00000000..8d8f1e3c
--- /dev/null
+++ b/ldap/include/regex.h
@@ -0,0 +1,63 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+#if defined( macintosh ) || defined( DOS ) || defined( _WINDOWS ) || defined( NEED_BSDREGEX )
+/*
+ * Copyright (c) 1993 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.
+ */
+/*
+ * regex.h -- includes for regular expression matching routines
+ * 13 August 1993 Mark C Smith
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ldap.h"
+
+#if !defined( NEEDPROTOS ) && defined( __STDC__ )
+#define NEEDPROTOS
+#endif
+
+#ifdef _SLDAPD_H_ /* server build: no need to use LDAP_CALL stuff */
+#ifdef LDAP_CALL
+#undef LDAP_CALL
+#define LDAP_CALL
+#endif
+#endif
+
+#ifdef NEEDPROTOS
+int slapd_re_init( void );
+void slapd_re_lock( void );
+int slapd_re_unlock( void );
+char * LDAP_CALL slapd_re_comp( char *pat );
+int LDAP_CALL slapd_re_exec( char *lp );
+void LDAP_CALL slapd_re_modw( char *s );
+int LDAP_CALL slapd_re_subs( char *src, char *dst );
+#else /* NEEDPROTOS */
+int slapd_re_init();
+void slapd_re_lock();
+int slapd_re_unlock();
+char * LDAP_CALL slapd_re_comp();
+int LDAP_CALL slapd_re_exec();
+void LDAP_CALL slapd_re_modw();
+int LDAP_CALL slapd_re_subs();
+#endif /* NEEDPROTOS */
+
+#define re_fail( m, p )
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* macintosh or DOS or or _WIN32 or NEED_BSDREGEX */
diff --git a/ldap/include/srchpref.h b/ldap/include/srchpref.h
new file mode 100644
index 00000000..e78f4441
--- /dev/null
+++ b/ldap/include/srchpref.h
@@ -0,0 +1,123 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/*
+ * 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
+ * 16 May 1994 by Gordon Good
+ */
+
+
+#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 */
+
+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 );
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _SRCHPREF_H */
diff --git a/ldap/include/sysexits-compat.h b/ldap/include/sysexits-compat.h
new file mode 100644
index 00000000..be6884d5
--- /dev/null
+++ b/ldap/include/sysexits-compat.h
@@ -0,0 +1,107 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/*
+ * Copyright (c) 1987 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley. 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'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#)sysexits.h 4.5 (Berkeley) 7/6/88
+ */
+
+/*
+** SYSEXITS.H -- Exit status codes for system programs.
+**
+** This include file attempts to categorize possible error
+** exit statuses for system programs, notably delivermail
+** and the Berkeley network.
+**
+** Error numbers begin at EX__BASE to reduce the possibility of
+** clashing with other exit statuses that random programs may
+** already return. The meaning of the codes is approximately
+** as follows:
+**
+** EX_USAGE -- The command was used incorrectly, e.g., with
+** the wrong number of arguments, a bad flag, a bad
+** syntax in a parameter, or whatever.
+** EX_DATAERR -- The input data was incorrect in some way.
+** This should only be used for user's data & not
+** system files.
+** EX_NOINPUT -- An input file (not a system file) did not
+** exist or was not readable. This could also include
+** errors like "No message" to a mailer (if it cared
+** to catch it).
+** EX_NOUSER -- The user specified did not exist. This might
+** be used for mail addresses or remote logins.
+** EX_NOHOST -- The host specified did not exist. This is used
+** in mail addresses or network requests.
+** EX_UNAVAILABLE -- A service is unavailable. This can occur
+** if a support program or file does not exist. This
+** can also be used as a catchall message when something
+** you wanted to do doesn't work, but you don't know
+** why.
+** EX_SOFTWARE -- An internal software error has been detected.
+** This should be limited to non-operating system related
+** errors as possible.
+** EX_OSERR -- An operating system error has been detected.
+** This is intended to be used for such things as "cannot
+** fork", "cannot create pipe", or the like. It includes
+** things like getuid returning a user that does not
+** exist in the passwd file.
+** EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
+** etc.) does not exist, cannot be opened, or has some
+** sort of error (e.g., syntax error).
+** EX_CANTCREAT -- A (user specified) output file cannot be
+** created.
+** EX_IOERR -- An error occurred while doing I/O on some file.
+** EX_TEMPFAIL -- temporary failure, indicating something that
+** is not really an error. In sendmail, this means
+** that a mailer (e.g.) could not create a connection,
+** and the request should be reattempted later.
+** EX_PROTOCOL -- the remote system returned something that
+** was "not possible" during a protocol exchange.
+** EX_NOPERM -- You did not have sufficient permission to
+** perform the operation. This is not intended for
+** file system problems, which should use NOINPUT or
+** CANTCREAT, but rather for higher level permissions.
+** For example, kre uses this to restrict who students
+** can send mail to.
+**
+** Maintained by Eric Allman (eric@berkeley, ucbvax!eric) --
+** please mail changes to me.
+**
+** @(#)sysexits.h 4.5 7/6/88
+*/
+
+# define EX_OK 0 /* successful termination */
+
+# define EX__BASE 64 /* base value for error messages */
+
+# define EX_USAGE 64 /* command line usage error */
+# define EX_DATAERR 65 /* data format error */
+# define EX_NOINPUT 66 /* cannot open input */
+# define EX_NOUSER 67 /* addressee unknown */
+# define EX_NOHOST 68 /* host name unknown */
+# define EX_UNAVAILABLE 69 /* service unavailable */
+# define EX_SOFTWARE 70 /* internal software error */
+# define EX_OSERR 71 /* system error (e.g., can't fork) */
+# define EX_OSFILE 72 /* critical OS file missing */
+# define EX_CANTCREAT 73 /* can't create (user) output file */
+# define EX_IOERR 74 /* input/output error */
+# define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
+# define EX_PROTOCOL 76 /* remote error in protocol */
+# define EX_NOPERM 77 /* permission denied */
+# define EX_CONFIG 78 /* configuration error */