]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/main.c
ITS#3917 don't check csn syntax if schema isn't inited yet
[openldap] / servers / slapd / main.c
index 4f0295f2d9e8634b020428f7db43bd0f53de31c4..02becaa502dffef82691e5d85472fb5931edd34c 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 
+#include <ac/ctype.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 #include <ac/time.h>
@@ -181,7 +182,7 @@ struct option_helper {
        const char      *oh_usage;
 } option_helpers[] = {
        { BER_BVC("slp"),       slapd_opt_slp,  NULL, "slp[={on|off}] enable/disable SLP" },
-       { BER_BVNULL }
+       { BER_BVNULL, 0, NULL, NULL }
 };
 
 static void
@@ -361,7 +362,17 @@ int main( int argc, char **argv )
                        scp = (struct sync_cookie *) ch_calloc( 1,
                                                                                sizeof( struct sync_cookie ));
                        ber_str2bv( optarg, 0, 1, &scp->octet_str );
-                       slap_parse_sync_cookie( scp );
+                       
+                       /* This only parses out the rid at this point */
+                       slap_parse_sync_cookie( scp, NULL );
+
+                       if ( scp->rid == -1 ) {
+                               Debug( LDAP_DEBUG_ANY,
+                                               "main: invalid cookie \"%s\"\n",
+                                               optarg, 0, 0 );
+                               slap_sync_cookie_free( scp, 1 );
+                               goto destroy;
+                       }
 
                        LDAP_STAILQ_FOREACH( scp_entry, &slap_sync_cookie, sc_next ) {
                                if ( scp->rid == scp_entry->rid ) {
@@ -378,7 +389,21 @@ int main( int argc, char **argv )
                case 'd':       /* set debug level and 'do not detach' flag */
                        no_detach = 1;
 #ifdef LDAP_DEBUG
-                       slap_debug |= atoi( optarg );
+                       if ( optarg != NULL && optarg[ 0 ] != '-' && !isdigit( optarg[ 0 ] ) )
+                       {
+                               int     level;
+
+                               if ( str2loglevel( optarg, &level ) ) {
+                                       fprintf( stderr,
+                                               "unrecognized log level "
+                                               "\"%s\"\n", optarg );
+                                       goto destroy;
+                               }
+
+                               slap_debug |= level;
+                       } else {
+                               slap_debug |= atoi( optarg );
+                       }
 #else
                        if ( atoi( optarg ) != 0 )
                                fputs( "must compile with LDAP_DEBUG for debugging\n",
@@ -609,16 +634,6 @@ unhandled_option:;
        (void) ldap_pvt_tls_set_option( NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &rc );
 #endif
 
-#ifdef LDAP_SLAPI
-       if ( slapi_int_initialize() != 0 ) {
-               Debug( LDAP_DEBUG_ANY,
-                   "slapi initialization error\n",
-                   0, 0, 0 );
-
-               goto destroy;
-       }
-#endif /* LDAP_SLAPI */
-
        if ( frontend_init() ) {
                goto destroy;
        }