]> git.sur5r.net Git - openldap/commitdiff
Fixes from Allan Lynne
authorKurt Zeilenga <kurt@openldap.org>
Tue, 18 Aug 1998 17:51:53 +0000 (17:51 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 18 Aug 1998 17:51:53 +0000 (17:51 +0000)
servers/slapd/back-ldbm/dn2id.c
servers/slapd/back-ldbm/idl.c
servers/slapd/dn.c
servers/slapd/main.c
servers/slapd/schema.c
servers/slurpd/main.c

index 4202a6fb14da4ee91cd5ccdb19c0ef50e3dda15a..4ee592da0748a1909ecea750c47e93d617461a25 100644 (file)
@@ -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 ) {
index 205b5b06488554a8de51c0989632f984b7b43ddf..7646765a0287cdd8f9aac63212c3a0c0f7ac148f 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <stdio.h>
 #include <sys/types.h>
-#include <sys/socket.h>
 #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 );
index 226937efa99f521a9c0cf0d6ef98deeb631f7fe7..7b76fe985ad5943453b2103631a1333f13c2938d 100644 (file)
@@ -206,7 +206,7 @@ dn_parent(
                }
        }
 
-       return( NULL );
+       return( strdup("") );
 }
 
 /*
index 152973310fc5c76934de257c7daab7a09b113bdc..fbbf450844468475e5027a818204d0168ce4ab21 100644 (file)
@@ -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;
index a5c297fbe3995976e2307fcb6101273322c86c93..816521d56f85f57fb35f3cf69a7528288fa01a93 100644 (file)
@@ -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 */
index 98ffb2917c236b95acf5b6102f4ed1d324b15b20..d4eeb6335b2aaacdb88809f231fff2c1ae5bc850 100644 (file)
@@ -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;