From 7e31732cc5832c8b33574f7be836d5cfe7009bb9 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Fri, 4 Apr 2003 04:06:18 +0000 Subject: [PATCH] Don't segfault on malformed configuration --- servers/slapd/back-meta/config.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/servers/slapd/back-meta/config.c b/servers/slapd/back-meta/config.c index 87ae4e76f4..f8d3fc5d30 100644 --- a/servers/slapd/back-meta/config.c +++ b/servers/slapd/back-meta/config.c @@ -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 ); -- 2.39.5