]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/main.c
reject registrations when back-monitor is not configured
[openldap] / servers / slapd / main.c
index 1cac009c99b3eaeb9f366d9eae9a0e0fb00efc4f..81fbed49f46f3908b573d304eee901a0d1160e66 100644 (file)
@@ -404,7 +404,17 @@ int main( int argc, char **argv )
 
                                slap_debug |= level;
                        } else {
-                               slap_debug |= atoi( optarg );
+                               int     level;
+                               char    *next = NULL;
+
+                               level = strtol( optarg, &next, 0 );
+                               if ( next == NULL || next[ 0 ] != '\0' ) {
+                                       fprintf( stderr,
+                                               "unrecognized log level "
+                                               "\"%s\"\n", optarg );
+                                       goto destroy;
+                               }
+                               slap_debug |= level;
                        }
 #else
                        if ( atoi( optarg ) != 0 )
@@ -594,60 +604,12 @@ unhandled_option:;
        lutil_passwd_init();
        slap_op_init();
 
-#ifdef SLAPD_MODULES
-       if ( module_init() != 0 ) {
-               rc = 1;
-               SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 17 );
-               goto destroy;
-       }
-#endif
-
-       if ( slap_schema_init( ) != 0 ) {
-               Debug( LDAP_DEBUG_ANY,
-                   "schema initialization error\n",
-                   0, 0, 0 );
-
-               goto destroy;
-       }
-
-       if ( slap_init( serverMode, serverName ) != 0 ) {
-               rc = 1;
+       rc = slap_init( serverMode, serverName );
+       if ( rc ) {
                SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 18 );
                goto destroy;
        }
 
-       if ( slap_controls_init( ) != 0 ) {
-               Debug( LDAP_DEBUG_ANY,
-                   "controls initialization error\n",
-                   0, 0, 0 );
-
-               goto destroy;
-       }
-
-#ifdef HAVE_TLS
-       /* Library defaults to full certificate checking. This is correct when
-        * a client is verifying a server because all servers should have a
-        * valid cert. But few clients have valid certs, so we want our default
-        * to be no checking. The config file can override this as usual.
-        */
-       rc = 0;
-       (void) ldap_pvt_tls_set_option( NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &rc );
-#endif
-
-       if ( frontend_init() ) {
-               goto destroy;
-       }
-
-       if ( overlay_init() ) {
-               goto destroy;
-       }
-
-#ifdef SLAP_DYNACL
-       if ( acl_init() ) {
-               goto destroy;
-       }
-#endif /* SLAP_DYNACL */
-
        if ( read_config( configfile, configdir ) != 0 ) {
                rc = 1;
                SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 19 );
@@ -669,6 +631,14 @@ unhandled_option:;
                }
        }
 
+       if ( glue_sub_init( ) != 0 ) {
+               Debug( LDAP_DEBUG_ANY,
+                   "subordinate config error\n",
+                   0, 0, 0 );
+
+               goto destroy;
+       }
+
        if ( slap_schema_check( ) != 0 ) {
                Debug( LDAP_DEBUG_ANY,
                    "schema prep error\n",