From dfeabf52139a18af713f31f54c16da0b679784a3 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 18 Aug 1998 17:51:53 +0000 Subject: [PATCH] Fixes from Allan Lynne --- servers/slapd/back-ldbm/dn2id.c | 6 +++++- servers/slapd/back-ldbm/idl.c | 5 ++++- servers/slapd/dn.c | 2 +- servers/slapd/main.c | 14 +++++++------- servers/slapd/schema.c | 5 +++++ servers/slurpd/main.c | 24 ++++++++++++++++++++++++ 6 files changed, 46 insertions(+), 10 deletions(-) diff --git a/servers/slapd/back-ldbm/dn2id.c b/servers/slapd/back-ldbm/dn2id.c index 4202a6fb14..4ee592da07 100644 --- a/servers/slapd/back-ldbm/dn2id.c +++ b/servers/slapd/back-ldbm/dn2id.c @@ -41,7 +41,11 @@ dn2id_add( data.dptr = (char *) &id; data.dsize = sizeof(ID); +#ifdef LDBM_PESSIMISTIC rc = ldbm_cache_store( db, key, data, LDBM_INSERT | LDBM_SYNC ); +#else + rc = ldbm_cache_store( db, key, data, LDBM_INSERT ); +#endif free( dn ); ldbm_cache_close( be, db ); @@ -62,10 +66,10 @@ dn2id( ID id; Datum key, data; - Debug( LDAP_DEBUG_TRACE, "=> dn2id( \"%s\" )\n", dn, 0, 0 ); dn = strdup( dn ); dn_normalize_case( dn ); + Debug( LDAP_DEBUG_TRACE, "=> dn2id( \"%s\" )\n", dn, 0, 0 ); /* first check the cache */ if ( (e = cache_find_entry_dn( &li->li_cache, dn )) != NULL ) { diff --git a/servers/slapd/back-ldbm/idl.c b/servers/slapd/back-ldbm/idl.c index 205b5b0648..7646765a02 100644 --- a/servers/slapd/back-ldbm/idl.c +++ b/servers/slapd/back-ldbm/idl.c @@ -2,7 +2,6 @@ #include #include -#include #include "slap.h" #include "ldapconfig.h" #include "back-ldbm.h" @@ -172,7 +171,11 @@ idl_store( data.dptr = (char *) idl; data.dsize = (2 + idl->b_nmax) * sizeof(ID); +#ifdef LDBM_PESSIMISTIC rc = ldbm_cache_store( db, key, data, LDBM_REPLACE | LDBM_SYNC ); +#else + rc = ldbm_cache_store( db, key, data, LDBM_REPLACE ); +#endif /* Debug( LDAP_DEBUG_TRACE, "<= idl_store %d\n", rc, 0, 0 ); */ return( rc ); diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 226937efa9..7b76fe985a 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -206,7 +206,7 @@ dn_parent( } } - return( NULL ); + return( strdup("") ); } /* diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 152973310f..fbbf450844 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -20,7 +20,7 @@ extern char Versionstr[]; * read-only global variables or variables only written by the listener * thread (after they are initialized) - no need to protect them with a mutex. */ -int ldap_debug; +int ldap_debug = 0; #ifdef LDAP_DEBUG int ldap_syslog = LDAP_DEBUG_STATS; #else @@ -64,7 +64,7 @@ static usage( name ) char *name; { - fprintf( stderr, "usage: %s [-d debuglevel] [-f configfile] [-p portnumber] [-s sysloglevel]\n", name ); + fprintf( stderr, "usage: %s [-d ?|debuglevel] [-f configfile] [-p portnumber] [-s sysloglevel]\n", name ); } main( argc, argv ) @@ -106,19 +106,19 @@ main( argc, argv ) LDAP_DEBUG_CONFIG ); printf( "\tLDAP_DEBUG_ACL\t\t%d\n", LDAP_DEBUG_ACL ); - printf( "\tLDAP_DEBUG_STATS\t\t%d\n", + printf( "\tLDAP_DEBUG_STATS\t%d\n", LDAP_DEBUG_STATS ); - printf( "\tLDAP_DEBUG_STATS2\t\t%d\n", + printf( "\tLDAP_DEBUG_STATS2\t%d\n", LDAP_DEBUG_STATS2 ); - printf( "\tLDAP_DEBUG_SHELL\t\t%d\n", + printf( "\tLDAP_DEBUG_SHELL\t%d\n", LDAP_DEBUG_SHELL ); - printf( "\tLDAP_DEBUG_PARSE\t\t%d\n", + printf( "\tLDAP_DEBUG_PARSE\t%d\n", LDAP_DEBUG_PARSE ); printf( "\tLDAP_DEBUG_ANY\t\t%d\n", LDAP_DEBUG_ANY ); exit( 0 ); } else { - ldap_debug = atoi( optarg ); + ldap_debug |= atoi( optarg ); lber_debug = (ldap_debug & LDAP_DEBUG_BER); } break; diff --git a/servers/slapd/schema.c b/servers/slapd/schema.c index a5c297fbe3..816521d56f 100644 --- a/servers/slapd/schema.c +++ b/servers/slapd/schema.c @@ -76,6 +76,11 @@ oc_check_required( Entry *e, char *ocname ) return( 0 ); } + /* check for empty oc_required */ + if(oc->oc_required == NULL) { + return( 0 ); + } + /* for each required attribute */ for ( i = 0; oc->oc_required[i] != NULL; i++ ) { /* see if it's in the entry */ diff --git a/servers/slurpd/main.c b/servers/slurpd/main.c index 98ffb2917c..d4eeb6335b 100644 --- a/servers/slurpd/main.c +++ b/servers/slurpd/main.c @@ -121,6 +121,10 @@ main( * Start the main file manager thread (in fm.c). */ pthread_attr_init( &attr ); +#ifndef THREAD_MIT_PTHREADS + /* POSIX_THREADS or compatible + * This is a draft 10 or standard pthreads implementation + */ if ( pthread_create( &(sglob->fm_tid), &attr, (void *) fm, (void *) NULL ) != 0 ) { Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n", @@ -128,17 +132,37 @@ main( exit( 1 ); } +#else /* !THREAD_MIT_PTHREADS */ + /* + * This is a draft 4 or earlier pthreads implementation + */ + if ( pthread_create( &(sglob->fm_tid), attr, (void *) fm, (void *) NULL ) + != 0 ) { + Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n", + 0, 0, 0 ); + exit( 1 ); + + } +#endif /* !THREAD_MIT_PTHREADS */ pthread_attr_destroy( &attr ); /* * Wait for the fm thread to finish. */ +#ifdef POSIX_THREADS + pthread_join( sglob->fm_tid, (void *) NULL ); +#else pthread_join( sglob->fm_tid, (void *) &status ); +#endif /* * Wait for the replica threads to finish. */ for ( i = 0; sglob->replicas[ i ] != NULL; i++ ) { +#ifdef POSIX_THREADS + pthread_join( sglob->replicas[ i ]->ri_tid, (void *) NULL ); +#else pthread_join( sglob->replicas[ i ]->ri_tid, (void *) &status ); +#endif } Debug( LDAP_DEBUG_ANY, "slurpd: terminating normally\n", 0, 0, 0 ); sglob->slurpd_shutdown = 1; -- 2.39.5