]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/init.c
streamline group attr specification/diagnostics
[openldap] / servers / slapd / init.c
index 4476d6a40e8317b5267100ed95ed27254764877a..0e392e2189d88a67233046cf1eac9bcdc442b0f2 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -71,11 +71,6 @@ ldap_pvt_thread_mutex_t      gmtime_mutex;
 
 slap_counters_t                        slap_counters;
 
-/*
- * these mutexes must be used when calling the entry2str()
- * routine since it returns a pointer to static data.
- */
-ldap_pvt_thread_mutex_t        entry2str_mutex;
 ldap_pvt_thread_mutex_t        replog_mutex;
 
 static const char* slap_name = NULL;
@@ -119,9 +114,17 @@ slap_init( int mode, const char *name )
                return 1;
        }
 
+       if ( entry_init() != 0 ) {
+               slap_debug |= LDAP_DEBUG_NONE;
+               Debug( LDAP_DEBUG_ANY,
+                   "%s: entry_init failed\n",
+                   name, 0, 0 );
+               return 1;
+       }
 
        switch ( slapMode & SLAP_MODE ) {
        case SLAP_SERVER_MODE:
+               root_dse_init();
 
                /* FALLTHRU */
        case SLAP_TOOL_MODE:
@@ -134,7 +137,6 @@ slap_init( int mode, const char *name )
 
                ldap_pvt_thread_pool_init( &connection_pool,
                                connection_pool_max, 0);
-               ldap_pvt_thread_mutex_init( &entry2str_mutex );
                ldap_pvt_thread_mutex_init( &replog_mutex );
 
                ldap_pvt_thread_mutex_init( &slap_counters.sc_sent_mutex );
@@ -168,6 +170,8 @@ slap_init( int mode, const char *name )
                if( rc == 0 ) {
                        rc = backend_init( );
                }
+               if ( rc )
+                       return rc;
 
                break;
 
@@ -271,10 +275,14 @@ int slap_destroy(void)
 
        slap_sasl_destroy();
 
+       /* rootdse destroy goes before entry_destroy()
+        * because it may use entry_free() */
+       root_dse_destroy();
        entry_destroy();
 
        switch ( slapMode & SLAP_MODE ) {
        case SLAP_SERVER_MODE:
+
        case SLAP_TOOL_MODE:
 
                ldap_pvt_thread_mutex_destroy( &slap_counters.sc_sent_mutex );