From: Kurt Zeilenga Date: Wed, 21 Oct 1998 23:49:46 +0000 (+0000) Subject: SLAPD compiles. Needs LDBM work to link. X-Git-Tag: PHP3_TOOL_0_0~18^2~24 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c0f5c884297aac7b930afad98f601912c83e9e72;p=openldap SLAPD compiles. Needs LDBM work to link. --- diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index 1098553319..cbd734612d 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -3,12 +3,10 @@ #include "portable.h" #include -#include -#include -#include -#include -#include -#include + +#include +#include +#include #include "slap.h" @@ -362,7 +360,7 @@ acl_access_allowed( return( (b->a_access & ~ACL_SELF) >= access ); } -#ifdef ACLGROUP +#ifdef SLAPD_ACLGROUPS if ( b->a_group != NULL && op->o_dn != NULL ) { char buf[512]; @@ -386,7 +384,7 @@ acl_access_allowed( return( (b->a_access & ~ACL_SELF) >= access ); } } -#endif /* ACLGROUP */ +#endif /* SLAPD_ACLGROUPS */ } if ( odn ) free( odn ); diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index a8ba951089..4e92136f92 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -3,16 +3,14 @@ #include "portable.h" #include -#include -#include -#include -#include -#include -#include -#include + +#include +#include +#include +#include +#include #include "slap.h" -#include "portable.h" extern Filter *str2filter(); extern struct acl *global_acl; @@ -210,11 +208,11 @@ parse_acl( } else if ( strcasecmp( left, "dnattr" ) == 0 ) { b->a_dnattr = strdup( right ); -#ifdef ACLGROUP +#ifdef SLAPD_ACLGROUPS } else if ( strcasecmp( left, "group" ) == 0 ) { regtest(fname, lineno, right); b->a_group = dn_upcase(strdup( right )); -#endif /* ACLGROUP */ +#endif /* SLAPD_ACLGROUPS */ } else if ( strcasecmp( left, "domain" ) == 0 ) { char *s; regtest(fname, lineno, right); diff --git a/servers/slapd/add.c b/servers/slapd/add.c index 7d31bc8744..110e3d365d 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -13,10 +13,11 @@ #include "portable.h" #include -#include -#include -#include -#include + +#include +#include +#include + #include "slap.h" extern Backend *select_backend(); diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index 5842813b96..1aa2392395 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -3,15 +3,22 @@ #include "portable.h" #include -#include -#include + +#ifdef HAVE_FCNTL_H #include -#include -#include -#include +#endif + +#include +#include +#include +#include + +#ifdef HAVE_SYS_PARAM_H #include +#endif + #include -#include "portable.h" + #include "slap.h" extern char **charray_dup(); diff --git a/servers/slapd/ava.c b/servers/slapd/ava.c index 12ef18cbf4..1e10339cb2 100644 --- a/servers/slapd/ava.c +++ b/servers/slapd/ava.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" int diff --git a/servers/slapd/back-ldbm/add.c b/servers/slapd/back-ldbm/add.c index 37b6a40635..eebcf4a257 100644 --- a/servers/slapd/back-ldbm/add.c +++ b/servers/slapd/back-ldbm/add.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" #include "proto-back-ldbm.h" diff --git a/servers/slapd/back-ldbm/attr.c b/servers/slapd/back-ldbm/attr.c index ca59ba3090..ea9694857f 100644 --- a/servers/slapd/back-ldbm/attr.c +++ b/servers/slapd/back-ldbm/attr.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" diff --git a/servers/slapd/back-ldbm/back-ldbm.h b/servers/slapd/back-ldbm/back-ldbm.h index 3d656f4dd9..dda1ff8452 100644 --- a/servers/slapd/back-ldbm/back-ldbm.h +++ b/servers/slapd/back-ldbm/back-ldbm.h @@ -9,7 +9,7 @@ LDAP_BEGIN_DECL #define DEFAULT_CACHE_SIZE 1000 -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 # define DEFAULT_DBCACHE_SIZE (100 * DEFAULT_DB_PAGE_SIZE) #else # define DEFAULT_DBCACHE_SIZE 100000 diff --git a/servers/slapd/back-ldbm/bind.c b/servers/slapd/back-ldbm/bind.c index 90aa228f08..f27872456e 100644 --- a/servers/slapd/back-ldbm/bind.c +++ b/servers/slapd/back-ldbm/bind.c @@ -3,45 +3,33 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include +#include +#include + #include "slap.h" #include "back-ldbm.h" #include "proto-back-ldbm.h" -#ifdef KERBEROS -#ifdef KERBEROS_V -#include -#else -#include -#endif /* KERBEROS_V */ -#endif /* KERBEROS */ - -#ifdef LDAP_CRYPT -/* change for crypted passwords -- lukeh */ -#ifdef __NeXT__ -extern char *crypt (char *key, char *salt); -#else -#include -#endif -#endif /* LDAP_CRYPT */ -#ifdef LDAP_SHA1 +#ifdef SLAPD_SHA1 #include -#endif /* LDAP_SHA1 */ -#ifdef LDAP_MD5 +#endif /* SLAPD_SHA1 */ + +#ifdef SLAPD_MD5 #include -#endif /* LDAP_MD5 */ +#endif /* SLAPD_MD5 */ #include extern Attribute *attr_find(); -#ifdef KERBEROS +#ifdef HAVE_KERBEROS extern int krbv4_ldap_auth(); #endif -#ifdef LDAP_CRYPT +#ifdef SLAPD_CRYPT pthread_mutex_t crypt_mutex; static int @@ -65,7 +53,7 @@ crypted_value_find( return ( 0 ); } pthread_mutex_unlock( &crypt_mutex ); -#ifdef LDAP_MD5 +#ifdef SLAPD_MD5 } else if ( syntax != SYNTAX_BIN && strncasecmp( "{MD5}", vals[i]->bv_val, (sizeof("{MD5}") - 1 ) ) == 0 ) { ldap_MD5_CTX MD5context; @@ -87,8 +75,8 @@ crypted_value_find( if (strcmp(userpassword, base64digest) == 0) { return ( 0 ); } -#endif /* LDAP_MD5 */ -#ifdef LDAP_SHA1 +#endif /* SLAPD_MD5 */ +#ifdef SLAPD_SHA1 } else if ( syntax != SYNTAX_BIN && strncasecmp( "{SHA}", vals[i]->bv_val, (sizeof("{SHA}") - 1 ) ) == 0 ) { ldap_SHA1_CTX SHA1context; @@ -110,7 +98,7 @@ crypted_value_find( if (strcmp(userpassword, base64digest) == 0) { return ( 0 ); } -#endif /* LDAP_SHA1 */ +#endif /* SLAPD_SHA1 */ } else { if ( value_cmp( vals[i], v, syntax, normalize ) == 0 ) { return( 0 ); @@ -120,7 +108,7 @@ crypted_value_find( return( 1 ); } -#endif /* LDAP_CRYPT */ +#endif /* SLAPD_CRYPT */ int ldbm_back_bind( @@ -137,7 +125,7 @@ ldbm_back_bind( Attribute *a; int rc; char *matched = NULL; -#ifdef KERBEROS +#ifdef HAVE_KERBEROS char krbname[MAX_K_NAME_SZ + 1]; AUTH_DAT ad; #endif @@ -195,7 +183,7 @@ ldbm_back_bind( goto return_results; } -#ifdef LDAP_CRYPT +#ifdef SLAPD_CRYPT if ( crypted_value_find( a->a_vals, cred, a->a_syntax, 0, cred ) != 0 ) #else if ( value_find( a->a_vals, cred, a->a_syntax, 0 ) != 0 ) @@ -214,7 +202,7 @@ ldbm_back_bind( rc = 0; break; -#ifdef KERBEROS +#ifdef HAVE_KERBEROS case LDAP_AUTH_KRBV41: if ( krbv4_ldap_auth( be, cred, &ad ) != LDAP_SUCCESS ) { send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS, diff --git a/servers/slapd/back-ldbm/cache.c b/servers/slapd/back-ldbm/cache.c index 4c5e7c3203..940a226b84 100644 --- a/servers/slapd/back-ldbm/cache.c +++ b/servers/slapd/back-ldbm/cache.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include + +#include #include "slap.h" + #include "back-ldbm.h" static int cache_delete_entry_internal(); diff --git a/servers/slapd/back-ldbm/close.c b/servers/slapd/back-ldbm/close.c index 66ef3e8606..f300d9f92d 100644 --- a/servers/slapd/back-ldbm/close.c +++ b/servers/slapd/back-ldbm/close.c @@ -3,8 +3,9 @@ #include "portable.h" #include -#include -#include + +#include + #include "slap.h" #include "back-ldbm.h" diff --git a/servers/slapd/back-ldbm/compare.c b/servers/slapd/back-ldbm/compare.c index 714923e177..e98f83dd94 100644 --- a/servers/slapd/back-ldbm/compare.c +++ b/servers/slapd/back-ldbm/compare.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" #include "proto-back-ldbm.h" diff --git a/servers/slapd/back-ldbm/config.c b/servers/slapd/back-ldbm/config.c index 5cbfd6e924..0e087dc0b1 100644 --- a/servers/slapd/back-ldbm/config.c +++ b/servers/slapd/back-ldbm/config.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" diff --git a/servers/slapd/back-ldbm/dbcache.c b/servers/slapd/back-ldbm/dbcache.c index bef299be86..ff09593f93 100644 --- a/servers/slapd/back-ldbm/dbcache.c +++ b/servers/slapd/back-ldbm/dbcache.c @@ -3,14 +3,17 @@ #include "portable.h" #include + +#include +#include #include #include -#include -#include -#include #include -#include + +#ifdef HAVE_SYS_PARAM_H +#include +#endif #include "slap.h" #include "back-ldbm.h" @@ -180,7 +183,7 @@ ldbm_cache_fetch( ) { Datum data; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &data, 0, sizeof( data ) ); #endif diff --git a/servers/slapd/back-ldbm/delete.c b/servers/slapd/back-ldbm/delete.c index ee5fbabca6..a7997e0f3f 100644 --- a/servers/slapd/back-ldbm/delete.c +++ b/servers/slapd/back-ldbm/delete.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" #include "proto-back-ldbm.h" diff --git a/servers/slapd/back-ldbm/dn2id.c b/servers/slapd/back-ldbm/dn2id.c index 89a5ea13ea..ff56ba616b 100644 --- a/servers/slapd/back-ldbm/dn2id.c +++ b/servers/slapd/back-ldbm/dn2id.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" #include "proto-back-ldbm.h" @@ -26,7 +27,7 @@ dn2id_add( Datum key, data; struct ldbminfo *li = (struct ldbminfo *) be->be_private; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &key, 0, sizeof( key ) ); memset( &data, 0, sizeof( data ) ); #endif @@ -71,7 +72,7 @@ dn2id( ID id; Datum key, data; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &key, 0, sizeof( key ) ); memset( &data, 0, sizeof( data ) ); #endif @@ -128,7 +129,7 @@ dn2id_delete( Datum key; int rc; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &key, 0, sizeof( key ) ); #endif diff --git a/servers/slapd/back-ldbm/filterindex.c b/servers/slapd/back-ldbm/filterindex.c index b65b841e24..ffb9292b42 100644 --- a/servers/slapd/back-ldbm/filterindex.c +++ b/servers/slapd/back-ldbm/filterindex.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" diff --git a/servers/slapd/back-ldbm/group.c b/servers/slapd/back-ldbm/group.c index e3e3436ceb..16106d8904 100644 --- a/servers/slapd/back-ldbm/group.c +++ b/servers/slapd/back-ldbm/group.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" #include "proto-back-ldbm.h" @@ -13,7 +14,7 @@ extern Attribute *attr_find(); -#ifdef ACLGROUP +#ifdef SLAPD_ACLGROUPS /* return 0 IFF edn is a value in uniqueMember attribute * of entry with bdn AND that entry has an objectClass * value of groupOfUniqueNames diff --git a/servers/slapd/back-ldbm/id2children.c b/servers/slapd/back-ldbm/id2children.c index 2906c5b2cb..b25a14c54d 100644 --- a/servers/slapd/back-ldbm/id2children.c +++ b/servers/slapd/back-ldbm/id2children.c @@ -3,8 +3,9 @@ #include "portable.h" #include -#include -#include + +#include + #include "slap.h" #include "back-ldbm.h" @@ -25,7 +26,7 @@ id2children_add( IDList *idl; char buf[20]; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &key, 0, sizeof( key ) ); memset( &data, 0, sizeof( data ) ); #endif @@ -70,7 +71,7 @@ has_children( IDList *idl; char buf[20]; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &key, 0, sizeof( key ) ); #endif diff --git a/servers/slapd/back-ldbm/id2entry.c b/servers/slapd/back-ldbm/id2entry.c index 140555c0c3..5e7582daf7 100644 --- a/servers/slapd/back-ldbm/id2entry.c +++ b/servers/slapd/back-ldbm/id2entry.c @@ -3,8 +3,9 @@ #include "portable.h" #include -#include -#include + +#include + #include "slap.h" #include "back-ldbm.h" @@ -23,7 +24,7 @@ id2entry_add( Backend *be, Entry *e ) Datum key, data; int len, rc, flags; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &key, 0, sizeof( key ) ); memset( &data, 0, sizeof( data ) ); #endif @@ -75,7 +76,7 @@ id2entry_delete( Backend *be, Entry *e ) /* XXX - check for writer lock - should also check no reader pending */ assert(pthread_rdwr_wchk_np(&e->e_rdwr)); -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &key, 0, sizeof( key ) ); #endif @@ -116,7 +117,7 @@ id2entry( Backend *be, ID id, int rw ) Datum key, data; Entry *e; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &key, 0, sizeof( key ) ); memset( &data, 0, sizeof( data ) ); #endif diff --git a/servers/slapd/back-ldbm/idl.c b/servers/slapd/back-ldbm/idl.c index d68c7b834b..88f089116f 100644 --- a/servers/slapd/back-ldbm/idl.c +++ b/servers/slapd/back-ldbm/idl.c @@ -3,12 +3,10 @@ #include "portable.h" #include + #include +#include -#include -#ifdef CLDAP -#include -#endif #include "slap.h" #include "ldapconfig.h" #include "back-ldbm.h" @@ -63,7 +61,7 @@ idl_fetch_one( char *kstr; int i, nids; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &k2, 0, sizeof( k2 ) ); memset( &data, 0, sizeof( data ) ); #endif @@ -90,7 +88,7 @@ idl_fetch( char *kstr; int i, nids; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &k2, 0, sizeof( k2 ) ); memset( &data, 0, sizeof( data ) ); #endif @@ -184,7 +182,7 @@ idl_store( Datum data; struct ldbminfo *li = (struct ldbminfo *) be->be_private; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &data, 0, sizeof( data ) ); #endif @@ -306,7 +304,7 @@ idl_insert_key( char *kstr; Datum k2; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &k2, 0, sizeof( k2 ) ); #endif diff --git a/servers/slapd/back-ldbm/index.c b/servers/slapd/back-ldbm/index.c index 1e58ab8c91..0581fc1a1e 100644 --- a/servers/slapd/back-ldbm/index.c +++ b/servers/slapd/back-ldbm/index.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" @@ -107,7 +108,7 @@ index_read( char *realval, *tmpval; char buf[BUFSIZ]; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &key, 0, sizeof( key ) ); #endif @@ -181,7 +182,7 @@ add_value( char *realval, *tmpval, *s; char buf[BUFSIZ]; -#ifdef LDBM_USE_DB2 +#ifdef HAVE_BERKELEY_DB2 memset( &key, 0, sizeof( key ) ); #endif diff --git a/servers/slapd/back-ldbm/init.c b/servers/slapd/back-ldbm/init.c index eaf886baf8..65fda43785 100644 --- a/servers/slapd/back-ldbm/init.c +++ b/servers/slapd/back-ldbm/init.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" @@ -17,9 +18,9 @@ ldbm_back_init( char *argv[ 4 ]; int i; -#ifdef LDAP_CRYPT +#ifdef SLAPD_CRYPT extern pthread_mutex_t crypt_mutex; -#endif /* LDAP_CRYPT */ +#endif /* SLAPD_CRYPT */ /* allocate backend-specific stuff */ li = (struct ldbminfo *) ch_calloc( 1, sizeof(struct ldbminfo) ); @@ -65,9 +66,9 @@ ldbm_back_init( pthread_mutex_init( &li->li_cache.c_mutex, pthread_mutexattr_default ); pthread_mutex_init( &li->li_nextid_mutex, pthread_mutexattr_default ); pthread_mutex_init( &li->li_dbcache_mutex, pthread_mutexattr_default ); -#ifdef LDAP_CRYPT +#ifdef SLAPD_CRYPT pthread_mutex_init( &crypt_mutex, pthread_mutexattr_default ); -#endif /* LDAP_CRYPT */ +#endif /* SLAPD_CRYPT */ pthread_cond_init( &li->li_dbcache_cv, pthread_condattr_default ); for ( i = 0; i < MAXDBCACHE; i++ ) { pthread_mutex_init( &li->li_dbcache[i].dbc_mutex, diff --git a/servers/slapd/back-ldbm/kerberos.c b/servers/slapd/back-ldbm/kerberos.c index c369c2bc13..14ab368db5 100644 --- a/servers/slapd/back-ldbm/kerberos.c +++ b/servers/slapd/back-ldbm/kerberos.c @@ -2,20 +2,17 @@ #include "portable.h" +#ifdef HAVE_KERBEROS + #include -#include -#include -#include + +#include +#include +#include + #include "slap.h" #include "back-ldbm.h" -#ifdef KERBEROS -#ifdef KERBEROS_V -#include -#else -#include -#endif /* KERBEROS_V */ - #define LDAP_KRB_PRINCIPAL "ldapserver" extern char *ldap_srvtab; diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index 455dd8c175..666547f1c9 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" #include "proto-back-ldbm.h" diff --git a/servers/slapd/back-ldbm/modrdn.c b/servers/slapd/back-ldbm/modrdn.c index 62a2acd18b..1555383045 100644 --- a/servers/slapd/back-ldbm/modrdn.c +++ b/servers/slapd/back-ldbm/modrdn.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" #include "proto-back-ldbm.h" diff --git a/servers/slapd/back-ldbm/nextid.c b/servers/slapd/back-ldbm/nextid.c index b680890a79..b16100a3f0 100644 --- a/servers/slapd/back-ldbm/nextid.c +++ b/servers/slapd/back-ldbm/nextid.c @@ -3,9 +3,13 @@ #include "portable.h" #include -#include -#include + +#include + +#ifdef HAVE_SYS_PARAM_H #include +#endif + #include "slap.h" #include "back-ldbm.h" diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index 2bf35034bf..705d6b47d6 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "back-ldbm.h" #include "proto-back-ldbm.h" diff --git a/servers/slapd/back-ldbm/unbind.c b/servers/slapd/back-ldbm/unbind.c index 56e3e426a4..6330b4db20 100644 --- a/servers/slapd/back-ldbm/unbind.c +++ b/servers/slapd/back-ldbm/unbind.c @@ -3,8 +3,9 @@ #include "portable.h" #include -#include -#include + +#include + #include "slap.h" int diff --git a/servers/slapd/back-passwd/config.c b/servers/slapd/back-passwd/config.c index 252717ab73..839af28cab 100644 --- a/servers/slapd/back-passwd/config.c +++ b/servers/slapd/back-passwd/config.c @@ -3,11 +3,11 @@ #include "portable.h" #include -#include -#include -#include -#include -#include "portable.h" + +#include +#include +#include + #include "slap.h" passwd_back_config( diff --git a/servers/slapd/back-passwd/search.c b/servers/slapd/back-passwd/search.c index 3e9a0f9a8c..7c32656ec2 100644 --- a/servers/slapd/back-passwd/search.c +++ b/servers/slapd/back-passwd/search.c @@ -3,12 +3,13 @@ #include "portable.h" #include -#include -#include -#include -#include + +#include +#include +#include + #include -#include "portable.h" + #include "slap.h" extern time_t currenttime; diff --git a/servers/slapd/back-shell/abandon.c b/servers/slapd/back-shell/abandon.c index 090ba26a4b..36e81963a9 100644 --- a/servers/slapd/back-shell/abandon.c +++ b/servers/slapd/back-shell/abandon.c @@ -3,10 +3,11 @@ #include "portable.h" #include -#include -#include -#include #include + +#include +#include + #include "slap.h" #include "shell.h" diff --git a/servers/slapd/back-shell/add.c b/servers/slapd/back-shell/add.c index e9840e9eaa..c798e8c6c1 100644 --- a/servers/slapd/back-shell/add.c +++ b/servers/slapd/back-shell/add.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "shell.h" diff --git a/servers/slapd/back-shell/bind.c b/servers/slapd/back-shell/bind.c index 2d8e5a0a13..33bcd9df97 100644 --- a/servers/slapd/back-shell/bind.c +++ b/servers/slapd/back-shell/bind.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "shell.h" diff --git a/servers/slapd/back-shell/compare.c b/servers/slapd/back-shell/compare.c index 642524f04d..ed93c411d9 100644 --- a/servers/slapd/back-shell/compare.c +++ b/servers/slapd/back-shell/compare.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "shell.h" diff --git a/servers/slapd/back-shell/config.c b/servers/slapd/back-shell/config.c index fc22aac49a..10aee26a2c 100644 --- a/servers/slapd/back-shell/config.c +++ b/servers/slapd/back-shell/config.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "shell.h" diff --git a/servers/slapd/back-shell/delete.c b/servers/slapd/back-shell/delete.c index e794a23a62..75760ed271 100644 --- a/servers/slapd/back-shell/delete.c +++ b/servers/slapd/back-shell/delete.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "shell.h" diff --git a/servers/slapd/back-shell/fork.c b/servers/slapd/back-shell/fork.c index 1b25031cbb..14eaca4349 100644 --- a/servers/slapd/back-shell/fork.c +++ b/servers/slapd/back-shell/fork.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" forkandexec( diff --git a/servers/slapd/back-shell/init.c b/servers/slapd/back-shell/init.c index b4087cb8a8..0865887123 100644 --- a/servers/slapd/back-shell/init.c +++ b/servers/slapd/back-shell/init.c @@ -3,8 +3,9 @@ #include "portable.h" #include -#include -#include + +#include + #include "slap.h" #include "shell.h" diff --git a/servers/slapd/back-shell/modify.c b/servers/slapd/back-shell/modify.c index b61dc8234d..ce2c7bfd07 100644 --- a/servers/slapd/back-shell/modify.c +++ b/servers/slapd/back-shell/modify.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "shell.h" diff --git a/servers/slapd/back-shell/modrdn.c b/servers/slapd/back-shell/modrdn.c index a4735164d0..f3f00217ad 100644 --- a/servers/slapd/back-shell/modrdn.c +++ b/servers/slapd/back-shell/modrdn.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "shell.h" diff --git a/servers/slapd/back-shell/result.c b/servers/slapd/back-shell/result.c index f1ac898526..3d18e23baa 100644 --- a/servers/slapd/back-shell/result.c +++ b/servers/slapd/back-shell/result.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "shell.h" diff --git a/servers/slapd/back-shell/search.c b/servers/slapd/back-shell/search.c index cbc3243d21..969215883b 100644 --- a/servers/slapd/back-shell/search.c +++ b/servers/slapd/back-shell/search.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "shell.h" diff --git a/servers/slapd/back-shell/unbind.c b/servers/slapd/back-shell/unbind.c index df836f3e8f..93c6889468 100644 --- a/servers/slapd/back-shell/unbind.c +++ b/servers/slapd/back-shell/unbind.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "shell.h" diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 93675af31b..d40093b087 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -4,13 +4,15 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include + #include "slap.h" -#ifdef LDAP_LDBM +#ifdef SLAPD_LDBM extern int ldbm_back_bind(); extern int ldbm_back_unbind(); extern int ldbm_back_search(); @@ -26,12 +28,12 @@ extern int ldbm_back_close(); extern int ldbm_back_group(); #endif -#ifdef LDAP_PASSWD +#ifdef SLAPD_PASSWD extern int passwd_back_search(); extern int passwd_back_config(); #endif -#ifdef LDAP_SHELL +#ifdef SLAPD_SHELL extern int shell_back_bind(); extern int shell_back_unbind(); extern int shell_back_search(); @@ -75,7 +77,7 @@ new_backend( be->be_timelimit = deftime; foundit = 0; -#ifdef LDAP_LDBM +#ifdef SLAPD_LDBM if ( strcasecmp( type, "ldbm" ) == 0 ) { be->be_bind = ldbm_back_bind; be->be_unbind = ldbm_back_unbind; @@ -89,7 +91,7 @@ new_backend( be->be_config = ldbm_back_config; be->be_init = ldbm_back_init; be->be_close = ldbm_back_close; -#ifdef ACLGROUP +#ifdef SLAPD_ACLGROUPS be->be_group = ldbm_back_group; #endif be->be_type = "ldbm"; @@ -97,7 +99,7 @@ new_backend( } #endif -#ifdef LDAP_PASSWD +#ifdef SLAPD_PASSWD if ( strcasecmp( type, "passwd" ) == 0 ) { be->be_bind = NULL; be->be_unbind = NULL; @@ -111,7 +113,7 @@ new_backend( be->be_config = passwd_back_config; be->be_init = NULL; be->be_close = NULL; -#ifdef ACLGROUP +#ifdef SLAPD_ACLGROUPS be->be_group = NULL; #endif be->be_type = "passwd"; @@ -119,7 +121,7 @@ new_backend( } #endif -#ifdef LDAP_SHELL +#ifdef SLAPD_SHELL if ( strcasecmp( type, "shell" ) == 0 ) { be->be_bind = shell_back_bind; be->be_unbind = shell_back_unbind; @@ -133,7 +135,7 @@ new_backend( be->be_config = shell_back_config; be->be_init = shell_back_init; be->be_close = NULL; -#ifdef ACLGROUP +#ifdef SLAPD_ACLGROUPS be->be_group = NULL; #endif be->be_type = "shell"; @@ -257,7 +259,7 @@ be_unbind( } } -#ifdef ACLGROUP +#ifdef SLAPD_ACLGROUPS int be_group(Backend *be, char *bdn, char *edn) { diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c index 4fa8478535..12a913bd15 100644 --- a/servers/slapd/bind.c +++ b/servers/slapd/bind.c @@ -15,9 +15,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" extern Backend *select_backend(); @@ -52,7 +53,7 @@ do_bind( * } */ -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 /* * in version 3.0 there is an extra SEQUENCE tag after the * BindRequest SEQUENCE tag. @@ -81,13 +82,13 @@ do_bind( "decoding error" ); return; } -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { switch ( method ) { case LDAP_AUTH_SIMPLE_30: method = LDAP_AUTH_SIMPLE; break; -#ifdef KERBEROS +#ifdef HAVE_KERBEROS case LDAP_AUTH_KRBV41_30: method = LDAP_AUTH_KRBV41; break; diff --git a/servers/slapd/ch_malloc.c b/servers/slapd/ch_malloc.c index 9f5cf56073..9ce0ed80ec 100644 --- a/servers/slapd/ch_malloc.c +++ b/servers/slapd/ch_malloc.c @@ -3,8 +3,10 @@ #include "portable.h" #include -#include -#include + +#include +#include + #include "slap.h" char * diff --git a/servers/slapd/charray.c b/servers/slapd/charray.c index 71ef9e6345..7edb80c848 100644 --- a/servers/slapd/charray.c +++ b/servers/slapd/charray.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" void diff --git a/servers/slapd/compare.c b/servers/slapd/compare.c index d836a43365..d31f2655a4 100644 --- a/servers/slapd/compare.c +++ b/servers/slapd/compare.c @@ -13,8 +13,9 @@ #include "portable.h" #include -#include -#include + +#include + #include "slap.h" extern Backend *select_backend(); diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 55660182c6..66e8567962 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "ldapconfig.h" diff --git a/servers/slapd/configinfo.c b/servers/slapd/configinfo.c index f6dcfe9d5f..744d611ad8 100644 --- a/servers/slapd/configinfo.c +++ b/servers/slapd/configinfo.c @@ -13,9 +13,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "ldapconfig.h" diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index bbfdd4344e..661877ffb4 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -1,12 +1,13 @@ #include "portable.h" #include + +#include +#include +#include #include #include -#include -#include -#include -#include + #include "slap.h" extern Operation *op_add(); @@ -18,11 +19,6 @@ extern long ops_completed; extern pthread_mutex_t ops_mutex; extern pthread_t listener_tid; -#ifdef DECL_SYS_ERRLIST -extern int sys_nerr; -extern char *sys_errlist[]; -#endif - struct co_arg { Connection *co_conn; Operation *co_op; @@ -52,7 +48,7 @@ connection_operation( struct co_arg *arg ) do_bind( arg->co_conn, arg->co_op ); break; -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_REQ_UNBIND_30: #endif case LDAP_REQ_UNBIND: @@ -63,7 +59,7 @@ connection_operation( struct co_arg *arg ) do_add( arg->co_conn, arg->co_op ); break; -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_REQ_DELETE_30: #endif case LDAP_REQ_DELETE: @@ -86,7 +82,7 @@ connection_operation( struct co_arg *arg ) do_search( arg->co_conn, arg->co_op ); break; -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_REQ_ABANDON_30: #endif case LDAP_REQ_ABANDON: @@ -177,7 +173,7 @@ connection_activity( return; } -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { (void) ber_skip_tag( ber, &len ); } @@ -205,7 +201,7 @@ connection_activity( pthread_attr_init( &attr ); pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED ); -#ifndef THREAD_MIT_PTHREADS +#if !defined(HAVE_PTHREADS_D4) && !defined(HAVE_DCE) /* POSIX_THREADS or compatible * This is a draft 10 or standard pthreads implementation */ @@ -217,7 +213,7 @@ connection_activity( active_threads++; pthread_mutex_unlock( &active_threads_mutex ); } -#else /* !THREAD_MIT_PTHREAD */ +#else /* pthread draft4 */ /* * This is a draft 4 or earlier pthreads implementation */ @@ -229,6 +225,6 @@ connection_activity( active_threads++; pthread_mutex_unlock( &active_threads_mutex ); } -#endif /* !THREAD_MIT_PTHREAD */ +#endif /* pthread draft4 */ pthread_attr_destroy( &attr ); } diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 1dfc8682b1..d95c0a059e 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -8,43 +8,33 @@ #include "portable.h" #include + +#include +#include +#include +#include #include -#include -#include -#include #include -#include -#include -#include -#include -#ifdef _AIX -#include -#endif +#include + #include "slap.h" #include "ldapconfig.h" -#ifdef NEED_FILIO + +#ifdef HAVE_SYS_FILIO_H #include -#else /* NEED_FILIO */ +#elif HAVE_SYS_IOCTL_H #include -#endif /* NEED_FILIO */ -#ifdef USE_SYSCONF -#include -#endif /* USE_SYSCONF */ +#endif -#ifdef TCP_WRAPPERS +#ifdef HAVE_TCPD #include int allow_severity = LOG_INFO; int deny_severity = LOG_NOTICE; -#endif /* TCP_WRAPPERS */ +#endif /* TCP Wrappers */ extern Operation *op_add(); -#ifdef DECL_SYS_ERRLIST -extern int sys_nerr; -extern char *sys_errlist[]; -#endif - extern time_t currenttime; extern pthread_mutex_t currenttime_mutex; extern int active_threads; @@ -79,14 +69,14 @@ slapd_daemon( FILE *fp; int on = 1; -#ifdef USE_SYSCONF +#ifdef HAVE_SYSCONF dtblsize = sysconf( _SC_OPEN_MAX ); -#else /* USE_SYSCONF */ +#elif HAVE_GETDTABLESIZE dtblsize = getdtablesize(); -#endif /* USE_SYSCONF */ - /* - * Add greg@greg.rim.or.jp - */ +#else + dtblsize = FD_SETSIZE +#endif + #ifdef FD_SETSIZE if(dtblsize > FD_SETSIZE) { dtblsize = FD_SETSIZE; @@ -151,14 +141,14 @@ slapd_daemon( } (void) SIGNAL( SIGPIPE, SIG_IGN ); -#ifdef linux +#ifdef HAVE_LINUX_THREADS /* * LinuxThreads are implemented using SIGUSR1/USR2, * so we'll use SIGSTKFLT and SIGUNUSED */ (void) SIGNAL( SIGSTKFLT, (void *) do_nothing ); (void) SIGNAL( SIGUNUSED, (void *) set_shutdown ); -#else /* !linux */ +#else /* !linux */ (void) SIGNAL( SIGUSR1, (void *) do_nothing ); (void) SIGNAL( SIGUSR2, (void *) set_shutdown ); #endif /* !linux */ @@ -284,7 +274,7 @@ slapd_daemon( char *s; client_addr = inet_ntoa( from.sin_addr ); -#if defined(REVERSE_LOOKUP) || defined(TCP_WRAPPERS) +#if defined(SLAPD_RLOOKUPS) || defined(HAVE_TCPD) hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr), sizeof(from.sin_addr.s_addr), AF_INET ); @@ -309,7 +299,7 @@ slapd_daemon( client_addr = NULL; } -#ifdef TCP_WRAPPERS +#ifdef HAVE_TCPD if(!hosts_ctl("slapd", client_name, client_addr, STRING_UNKNOWN)) { @@ -325,7 +315,7 @@ slapd_daemon( pthread_mutex_unlock( &new_conn_mutex ); continue; } -#endif /* TCP_WRAPPERS */ +#endif /* HAVE_TCPD */ Statslog( LDAP_DEBUG_STATS, "conn=%d fd=%d connection from %s (%s) accepted.\n", @@ -424,7 +414,7 @@ set_shutdown() { Debug( LDAP_DEBUG_ANY, "slapd got shutdown signal\n", 0, 0, 0 ); slapd_shutdown = 1; -#ifdef linux +#ifdef HAVE_LINUX_THREADS /* * LinuxThreads are implemented using SIGUSR1/USR2, * so we'll use SIGSTKFLT and SIGUNUSED @@ -444,7 +434,7 @@ static void do_nothing() { Debug( LDAP_DEBUG_TRACE, "slapd got do_nothing signal\n", 0, 0, 0 ); -#ifdef linux +#ifdef HAVE_LINUX_THREADS /* * LinuxThreads are implemented using SIGUSR1/USR2, * so we'll use SIGSTKFLT and SIGUNUSED diff --git a/servers/slapd/delete.c b/servers/slapd/delete.c index bab22d924f..eecf64090f 100644 --- a/servers/slapd/delete.c +++ b/servers/slapd/delete.c @@ -13,9 +13,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" extern Backend *select_backend(); diff --git a/servers/slapd/detach.c b/servers/slapd/detach.c index bb28bc96a2..dd6db49d69 100644 --- a/servers/slapd/detach.c +++ b/servers/slapd/detach.c @@ -13,20 +13,14 @@ #include "portable.h" #include -#include -#ifdef SVR4 + +#include +#include + #include -#endif /* svr4 */ #include #include #include -#include -#include "portable.h" - -#ifdef USE_SYSCONF -#include -#endif /* USE_SYSCONF */ - detach() { @@ -35,11 +29,13 @@ detach() extern int ldap_debug; #endif -#ifdef USE_SYSCONF +#ifdef HAVE_SYSCONF nbits = sysconf( _SC_OPEN_MAX ); -#else /* USE_SYSCONF */ +#elif HAVE_GETDTABLESIZE nbits = getdtablesize(); -#endif /* USE_SYSCONF */ +#else + nbits = FD_SETSIZE +#endif #ifdef FD_SETSIZE if ( nbits > FD_SETSIZE ) { @@ -51,7 +47,7 @@ detach() if ( ldap_debug == 0 ) { #endif for ( i = 0; i < 5; i++ ) { -#if defined( sunos5 ) && defined( THREAD_SUNOS5_LWP ) +#if defined( HAVE_LWP_THR ) switch ( fork1() ) { #else switch ( fork() ) { @@ -88,14 +84,14 @@ detach() (void) dup2( sd, 2 ); close( sd ); -#ifdef USE_SETSID +#ifdef HAVE_SETSID setsid(); -#else /* USE_SETSID */ +#else /* HAVE_SETSID */ if ( (sd = open( "/dev/tty", O_RDWR )) != -1 ) { (void) ioctl( sd, TIOCNOTTY, NULL ); (void) close( sd ); } -#endif /* USE_SETSID */ +#endif /* HAVE_SETSID */ #ifdef LDAP_DEBUG } #endif diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index de10e368c7..d67aca70ac 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -3,11 +3,12 @@ #include "portable.h" #include -#include -#include -#include -#include -#include + +#include +#include +#include +#include + #include "slap.h" static char **dn_explode(); diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index 562cc47b68..c0474e2023 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -3,10 +3,11 @@ #include "portable.h" #include -#include -#include -#include -#include + +#include +#include +#include + #include "slap.h" void entry_free(); diff --git a/servers/slapd/filter.c b/servers/slapd/filter.c index 49f8166f2b..be8a8ea242 100644 --- a/servers/slapd/filter.c +++ b/servers/slapd/filter.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" static int get_filter_list(); @@ -56,7 +57,7 @@ get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr ) err = 0; *fstr = NULL; f->f_choice = ber_peek_tag( ber, &len ); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { switch ( f->f_choice ) { case LDAP_FILTER_EQUALITY: @@ -194,7 +195,7 @@ get_filter_list( Connection *conn, BerElement *ber, Filter **f, char **fstr ) Debug( LDAP_DEBUG_FILTER, "begin get_filter_list\n", 0, 0, 0 ); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { (void) ber_skip_tag( ber, &len ); } @@ -235,7 +236,7 @@ get_substring_filter( Debug( LDAP_DEBUG_FILTER, "begin get_substring_filter\n", 0, 0, 0 ); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { (void) ber_skip_tag( ber, &len ); } @@ -253,7 +254,7 @@ get_substring_filter( sprintf( *fstr, "(%s=", f->f_sub_type ); for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT; tag = ber_next_element( ber, &len, last ) ) { -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { rc = ber_scanf( ber, "{a}", &val ); } else @@ -271,7 +272,7 @@ get_substring_filter( value_normalize( val, syntax ); switch ( tag ) { -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_SUBSTRING_INITIAL_30: #endif case LDAP_SUBSTRING_INITIAL: @@ -285,7 +286,7 @@ get_substring_filter( strcat( *fstr, val ); break; -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_SUBSTRING_ANY_30: #endif case LDAP_SUBSTRING_ANY: @@ -297,7 +298,7 @@ get_substring_filter( strcat( *fstr, val ); break; -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_SUBSTRING_FINAL_30: #endif case LDAP_SUBSTRING_FINAL: diff --git a/servers/slapd/filterentry.c b/servers/slapd/filterentry.c index 495fcb2ca6..ac0a943d02 100644 --- a/servers/slapd/filterentry.c +++ b/servers/slapd/filterentry.c @@ -3,10 +3,11 @@ #include "portable.h" #include -#include -#include -#include -#include + +#include +#include +#include + #include "slap.h" extern Attribute *attr_find(); diff --git a/servers/slapd/init.c b/servers/slapd/init.c index 7ba8318758..81384199e3 100644 --- a/servers/slapd/init.c +++ b/servers/slapd/init.c @@ -3,13 +3,11 @@ #include "portable.h" #include -#include -#include -#include -#include -#include -#include -#include + +#include +#include +#include + #include "portable.h" #include "slap.h" diff --git a/servers/slapd/lock.c b/servers/slapd/lock.c index 2e3cb917fd..debc102e2e 100644 --- a/servers/slapd/lock.c +++ b/servers/slapd/lock.c @@ -3,15 +3,13 @@ #include "portable.h" #include -#include -#include -#include "portable.h" -#ifdef USE_LOCKF -#include -#endif + +#include +#include +#include + #include #include -#include #include "slap.h" FILE * diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 258923e61e..59fb391b1f 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -1,14 +1,11 @@ #include "portable.h" #include -#include -#include -#include -#include -#include -#include -#include -#include "portable.h" + +#include +#include +#include + #include "slap.h" #include "ldapconfig.h" @@ -184,7 +181,7 @@ main( argc, argv ) pthread_attr_init( &attr ); pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED ); -#ifndef THREAD_MIT_PTHREADS +#if !defined(HAVE_PTHREADS_D4) && !defined(HAVE_DCE) /* POSIX_THREADS or compatible * This is a draft 10 or standard pthreads implementation */ @@ -194,7 +191,7 @@ main( argc, argv ) "listener pthread_create failed\n", 0, 0, 0 ); exit( 1 ); } -#else /* !THREAD_MIT_PTHREADS */ +#else /* draft4 */ /* * This is a draft 4 or earlier pthreads implementation */ @@ -204,7 +201,7 @@ main( argc, argv ) "listener pthread_create failed\n", 0, 0, 0 ); exit( 1 ); } -#endif /* !THREAD_MIT_PTHREADS */ +#endif /* !draft4 */ pthread_attr_destroy( &attr ); pthread_join( listener_tid, (void *) &status ); pthread_exit( 0 ); @@ -236,7 +233,7 @@ main( argc, argv ) #endif flen = sizeof(from); if ( getpeername( 0, (struct sockaddr *) &from, &flen ) == 0 ) { -#ifdef REVERSE_LOOKUP +#ifdef SLAPD_RLOOKUPS hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr), sizeof(from.sin_addr.s_addr), AF_INET ); #else diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index 2820a3ed19..1406b985b5 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -13,11 +13,11 @@ #include "portable.h" #include -#include -#include -#include -#include -#include + +#include +#include +#include + #include "slap.h" extern Backend *select_backend(); diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index 75af6e13e8..4928727817 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -13,9 +13,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" extern Backend *select_backend(); diff --git a/servers/slapd/monitor.c b/servers/slapd/monitor.c index c43b61ac46..05940823ca 100644 --- a/servers/slapd/monitor.c +++ b/servers/slapd/monitor.c @@ -20,10 +20,11 @@ #include "portable.h" #include -#include -#include -#include -#include + +#include +#include +#include + #include "slap.h" #include "ldapconfig.h" @@ -194,7 +195,7 @@ monitor_info( Connection *conn, Operation *op ) val.bv_len = strlen( buf ); attr_merge( e, "nbackends", vals ); -#ifdef THREAD_SUNOS5_LWP +#ifdef HAVE_LWP_THR sprintf( buf, "%d", thr_getconcurrency() ); val.bv_val = buf; val.bv_len = strlen( buf ); diff --git a/servers/slapd/operation.c b/servers/slapd/operation.c index a960c30695..b08d679298 100644 --- a/servers/slapd/operation.c +++ b/servers/slapd/operation.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" extern time_t currenttime; diff --git a/servers/slapd/phonetic.c b/servers/slapd/phonetic.c index 996c68160c..485e3718a7 100644 --- a/servers/slapd/phonetic.c +++ b/servers/slapd/phonetic.c @@ -3,15 +3,15 @@ #include "portable.h" #include -#include -#include -#include -#include -#include -#include "portable.h" + +#include +#include +#include +#include + #include "slap.h" -#if !defined(METAPHONE) && !defined(SOUNDEX) +#if !defined(METAPHONE) && !defined(SLAPD_PHONETIC) #define METAPHONE #endif @@ -79,7 +79,7 @@ word_dup( char *w ) #define MAXPHONEMELEN 4 #endif -#if defined(SOUNDEX) +#if defined(SLAPD_PHONETIC) /* lifted from isode-8.0 */ char * @@ -430,4 +430,4 @@ phonetic( char *Word ) } #endif /* metaphone */ -#endif /* soundex */ +#endif /* SLAPD_PHONETIC */ diff --git a/servers/slapd/repl.c b/servers/slapd/repl.c index cd0198ebd7..4450be5866 100644 --- a/servers/slapd/repl.c +++ b/servers/slapd/repl.c @@ -3,10 +3,12 @@ #include "portable.h" #include -#include -#include + +#include +#include + #include -#include + #include "slap.h" extern pthread_mutex_t replog_mutex; diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 185cc0269d..07bf54540f 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -3,19 +3,14 @@ #include "portable.h" #include + +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include "slap.h" -#ifdef DECL_SYS_ERRLIST -extern int sys_nerr; -extern char *sys_errlist[]; -#endif +#include "slap.h" extern int active_threads; extern pthread_mutex_t active_threads_mutex; @@ -63,7 +58,7 @@ send_ldap_result2( break; } -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( (ber = ber_alloc_t( conn->c_version == 30 ? 0 : LBER_USE_DER )) == NULLBER ) { #else @@ -73,13 +68,13 @@ send_ldap_result2( return; } -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( op->o_cldap ) { rc = ber_printf( ber, "{is{t{ess}}}", op->o_msgid, "", tag, err, matched ? matched : "", text ? text : "" ); } else #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { rc = ber_printf( ber, "{it{{ess}}}", op->o_msgid, tag, err, matched ? matched : "", text ? text : "" ); @@ -124,7 +119,7 @@ send_ldap_result2( active_threads--; conn->c_writewaiter = 1; -#ifdef linux +#ifdef HAVE_LINUX_THREADS pthread_kill( listener_tid, SIGSTKFLT ); #else /* !linux */ pthread_kill( listener_tid, SIGUSR1 ); @@ -159,7 +154,7 @@ send_ldap_result( char *text ) { -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( op->o_cldap ) { SAFEMEMCPY( (char *)conn->c_sb.sb_useaddr, &op->o_clientaddr, sizeof( struct sockaddr )); @@ -213,7 +208,7 @@ send_search_entry( edn = dn_normalize_case( strdup( e->e_dn ) ); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( (ber = ber_alloc_t( conn->c_version == 30 ? 0 : LBER_USE_DER )) == NULLBER ) #else @@ -226,7 +221,7 @@ send_search_entry( goto error_return; } -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { rc = ber_printf( ber, "{it{{s{", op->o_msgid, LDAP_RES_SEARCH_ENTRY, e->e_dn ); @@ -315,7 +310,7 @@ send_search_entry( free(edn); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { rc = ber_printf( ber, "}}}}" ); } else diff --git a/servers/slapd/schema.c b/servers/slapd/schema.c index fc5f0214fa..a324a60d1d 100644 --- a/servers/slapd/schema.c +++ b/servers/slapd/schema.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" extern Attribute *attr_find(); diff --git a/servers/slapd/schemaparse.c b/servers/slapd/schemaparse.c index 70edf66b8b..8f72136abb 100644 --- a/servers/slapd/schemaparse.c +++ b/servers/slapd/schemaparse.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" extern char **str2charray(); diff --git a/servers/slapd/search.c b/servers/slapd/search.c index 721c013f84..a1c34b76da 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -13,9 +13,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" #include "ldapconfig.h" diff --git a/servers/slapd/shell-backends/Makefile.in b/servers/slapd/shell-backends/Makefile.in index aab59ca8fc..8789dede37 100644 --- a/servers/slapd/shell-backends/Makefile.in +++ b/servers/slapd/shell-backends/Makefile.in @@ -7,6 +7,11 @@ OBJS = passwd-shell.o shellutil.o LDAP_INCDIR= ../../../include LDAP_LIBDIR= ../../../libraries +BUILD_OPT = "--enable-shell" +BUILD_SRV = @BUILD_SHELL@ + +all-local: $(PROGRAMS) + passwd-shell: pwd-version.o $(CC) $(LDFLAGS) -o $@ $(OBJS) pwd-version.o $(LIBS) diff --git a/servers/slapd/shell-backends/passwd-shell.c b/servers/slapd/shell-backends/passwd-shell.c index fd354e0fe4..2d7df71c74 100644 --- a/servers/slapd/shell-backends/passwd-shell.c +++ b/servers/slapd/shell-backends/passwd-shell.c @@ -15,27 +15,21 @@ #include "portable.h" -#include #include -#include #include #include -#include + +#include + #include #include + #include "shellutil.h" #include "passwd-shell.h" -#ifdef LDAP_DEBUG -void debug_printf(); -#else /* LDAP_DEBUG */ -#define debug_printf() -#endif /* LDAP_DEBUG */ - - -static void pwdfile_search( struct ldop *op, FILE *ofp ); -static struct ldentry *pw2entry( struct ldop *op, struct passwd *pw ); +static void pwdfile_search LDAP_P(( struct ldop *op, FILE *ofp )); +static struct ldentry *pw2entry LDAP_P(( struct ldop *op, struct passwd *pw )); static char tmpbuf[ MAXLINELEN * 2 ]; diff --git a/servers/slapd/shell-backends/shellutil.c b/servers/slapd/shell-backends/shellutil.c index e1a6d030a4..4f7b469043 100644 --- a/servers/slapd/shell-backends/shellutil.c +++ b/servers/slapd/shell-backends/shellutil.c @@ -16,12 +16,19 @@ #include "portable.h" -#include #include -#include + +#ifdef STDC_HEADERS #include -#include +#include +#else #include +#endif + +#include + +#include + #include #include #include "shellutil.h" @@ -316,19 +323,30 @@ ecalloc( unsigned nelem, unsigned elsize ) /* VARARGS */ void -debug_printf( va_alist /* char *fmt, args... */ ) +debug_printf +#ifdef STDC_HEADERS + ( char *fmt, ... ) +#else + ( va_alist ) va_dcl +#endif { - char *fmt; va_list ap; - - if ( debugflg ) { - va_start( ap ); - fmt = va_arg( ap, char * ); - fprintf( stderr, "%s: ", progname ); - vfprintf( stderr, fmt, ap ); - va_end( ap ); - } +#ifndef STDC_HEADERS + char *fmt; +#endif + + if ( debugflg ) { +#ifdef STDC_HEADERS + va_start( ap, fmt ); +#else + va_start( ap ); + fmt = va_arg( ap, char * ); +#endif + fprintf( stderr, "%s: ", progname ); + vfprintf( stderr, fmt, ap ); + va_end( ap ); + } } diff --git a/servers/slapd/shell-backends/shellutil.h b/servers/slapd/shell-backends/shellutil.h index 8c52ab5dcf..58775b2f99 100644 --- a/servers/slapd/shell-backends/shellutil.h +++ b/servers/slapd/shell-backends/shellutil.h @@ -75,7 +75,7 @@ struct ldentry { #ifdef LDAP_DEBUG -void debug_printf(); +void debug_printf LDAP_P((char *, ...)); #else /* LDAP_DEBUG */ #define debug_printf() #endif /* LDAP_DEBUG */ diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index f5dee02400..fad750b28d 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -139,7 +139,7 @@ struct access { char *a_dnattr; long a_access; -#ifdef SLAPD_ACLGROUP +#ifdef SLAPD_ACLGROUPS char *a_group; #endif @@ -211,7 +211,7 @@ typedef struct backend { IFP be_init; /* backend init routine */ IFP be_close; /* backend close routine */ -#ifdef ACLGROUP +#ifdef SLAPD_ACLGROUPS IFP be_group; /* backend group member test */ #endif } Backend; diff --git a/servers/slapd/str2filter.c b/servers/slapd/str2filter.c index 46b80f5fe6..5aea1d55b3 100644 --- a/servers/slapd/str2filter.c +++ b/servers/slapd/str2filter.c @@ -3,9 +3,10 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" static char *find_matching_paren(); diff --git a/servers/slapd/strdup.c b/servers/slapd/strdup.c index ec7398d4a8..d9c24e69cb 100644 --- a/servers/slapd/strdup.c +++ b/servers/slapd/strdup.c @@ -1,8 +1,8 @@ #include "portable.h" -#if defined( ultrix ) || defined( nextstep ) +#ifndef HAVE_STRDUP -#include +#include char *strdup( char *s ) { @@ -16,4 +16,4 @@ char *strdup( char *s ) return( p ); } -#endif /* ultrix || nextstep */ +#endif /* !strdup */ diff --git a/servers/slapd/tempnam.c b/servers/slapd/tempnam.c index 53c0e50228..9aa21870b8 100644 --- a/servers/slapd/tempnam.c +++ b/servers/slapd/tempnam.c @@ -1,10 +1,8 @@ #include "portable.h" -#if defined( nextstep ) +#ifndef HAVE_TEMPNAME -#include - -char *tempnam( char *dir, char *pfx ); +#include char *tempnam( char *dir, char *pfx ) { diff --git a/servers/slapd/unbind.c b/servers/slapd/unbind.c index 487fbbead5..1b0d820e68 100644 --- a/servers/slapd/unbind.c +++ b/servers/slapd/unbind.c @@ -16,8 +16,9 @@ #include "portable.h" #include -#include -#include + +#include + #include "slap.h" extern Backend *select_backend(); diff --git a/servers/slapd/value.c b/servers/slapd/value.c index 5be4338ed0..f5ee5f4777 100644 --- a/servers/slapd/value.c +++ b/servers/slapd/value.c @@ -1,13 +1,16 @@ /* value.c - routines for dealing with values */ #include "portable.h" + #include -#include -#include -#include -#include + +#include +#include +#include +#include + #include -#include "portable.h" + #include "slap.h" int @@ -100,7 +103,7 @@ value_normalize( *d = '\0'; } -#define MIN( a, b ) (a < b ? a : b ) +#define LDAP_MIN( a, b ) ((a) < (b) ? (a) : (b) ) int value_cmp( @@ -134,7 +137,7 @@ value_cmp( break; case SYNTAX_BIN: - rc = memcmp( v1->bv_val, v2->bv_val, MIN( v1->bv_len, + rc = memcmp( v1->bv_val, v2->bv_val, LDAP_MIN( v1->bv_len, v2->bv_len ) ); break; }