]> git.sur5r.net Git - openldap/commitdiff
Don't segfault on malformed configuration
authorLuke Howard <lukeh@openldap.org>
Fri, 4 Apr 2003 04:06:18 +0000 (04:06 +0000)
committerLuke Howard <lukeh@openldap.org>
Fri, 4 Apr 2003 04:06:18 +0000 (04:06 +0000)
servers/slapd/back-meta/config.c

index 87ae4e76f46cdc676453ebdbdb778027adfb6ab1..f8d3fc5d30a62ca0ef064f2bbe430045a99ed9e0 100644 (file)
@@ -321,6 +321,7 @@ meta_back_db_config(
                        fprintf( stderr,
        "%s: line %d: need \"uri\" directive first\n",
                                fname, lineno );
+                       return 1;
                }
                
                if ( argc != 2 ) {
@@ -347,6 +348,7 @@ meta_back_db_config(
                        fprintf( stderr,
        "%s: line %d: need \"uri\" directive first\n",
                                fname, lineno );
+                       return 1;
                }
                
                if ( argc != 2 ) {
@@ -376,6 +378,7 @@ meta_back_db_config(
                        fprintf( stderr,
        "%s: line %d: need \"uri\" directive first\n",
                                fname, lineno );
+                       return 1;
                }
                
                if ( argc != 2 ) {
@@ -402,6 +405,7 @@ meta_back_db_config(
                        fprintf( stderr,
        "%s: line %d: need \"uri\" directive first\n",
                                fname, lineno );
+                       return 1;
                }
                
                if ( argc != 2 ) {
@@ -523,6 +527,13 @@ meta_back_db_config(
        } else if ( strcasecmp( argv[ 0 ], "map" ) == 0 ) {
                int             i = li->ntargets-1;
 
+               if ( i < 0 ) {
+                       fprintf( stderr,
+       "%s: line %d: need \"uri\" directive first\n",
+                               fname, lineno );
+                       return 1;
+               }
+
                return ldap_back_map_config( &li->targets[ i ]->oc_map, 
                                &li->targets[ i ]->at_map,
                                fname, lineno, argc, argv );