From: Howard Chu Date: Sun, 7 Dec 2003 07:07:00 +0000 (+0000) Subject: Cleanup unknown config directive handling. X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~238 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0690f79a5a6749ea940b48d2aa0af689a7f3f2ab;p=openldap Cleanup unknown config directive handling. --- diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index c05df616d3..b3df31e322 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -252,9 +252,7 @@ bdb_db_config( /* anything else */ } else { - fprintf( stderr, "%s: line %d: " - "unknown directive \"%s\" in bdb database definition (ignored)\n", - fname, lineno, argv[0] ); + return SLAP_CONF_UNKNOWN; } return 0; diff --git a/servers/slapd/back-dnssrv/config.c b/servers/slapd/back-dnssrv/config.c index 7a6cb3318d..f3ec06c2fe 100644 --- a/servers/slapd/back-dnssrv/config.c +++ b/servers/slapd/back-dnssrv/config.c @@ -47,10 +47,7 @@ dnssrv_back_db_config( /* no configuration options (yet) */ { - fprintf( stderr, - "%s: line %d: unknown directive \"%s\"" - " in DNSSRV database definition (ignored)\n", - fname, lineno, argv[0] ); + return SLAP_CONF_UNKNOWN; } return 0; } diff --git a/servers/slapd/back-ldap/config.c b/servers/slapd/back-ldap/config.c index 1b01ba800b..e09113421b 100644 --- a/servers/slapd/back-ldap/config.c +++ b/servers/slapd/back-ldap/config.c @@ -262,9 +262,7 @@ ldap_back_db_config( /* anything else */ } else { - fprintf( stderr, "%s: line %d: unknown directive \"%s\" " - "in ldap database definition (ignored)\n", - fname, lineno, argv[0] ); + return SLAP_CONF_UNKNOWN; } return 0; } diff --git a/servers/slapd/back-ldbm/config.c b/servers/slapd/back-ldbm/config.c index 71259aa35b..6873f4950c 100644 --- a/servers/slapd/back-ldbm/config.c +++ b/servers/slapd/back-ldbm/config.c @@ -199,9 +199,7 @@ ldbm_back_db_config( /* anything else */ } else { - fprintf( stderr, -"%s: line %d: unknown directive \"%s\" in ldbm database definition (ignored)\n", - fname, lineno, argv[0] ); + return SLAP_CONF_UNKNOWN; } return 0; diff --git a/servers/slapd/back-meta/config.c b/servers/slapd/back-meta/config.c index 9772987427..443e1a71d3 100644 --- a/servers/slapd/back-meta/config.c +++ b/servers/slapd/back-meta/config.c @@ -565,10 +565,7 @@ meta_back_db_config( fname, lineno, argc, argv ); /* anything else */ } else { - fprintf( stderr, - "%s: line %d: unknown directive \"%s\" in meta database definition" - " (ignored)\n", - fname, lineno, argv[0] ); + return SLAP_CONF_UNKNOWN; } return 0; } diff --git a/servers/slapd/back-monitor/init.c b/servers/slapd/back-monitor/init.c index 3ff3eb9510..c6dad69a99 100644 --- a/servers/slapd/back-monitor/init.c +++ b/servers/slapd/back-monitor/init.c @@ -929,7 +929,7 @@ monitor_back_config( /* * eventually, will hold backend specific configuration parameters */ - return 0; + return SLAP_CONF_UNKNOWN; } int @@ -954,15 +954,7 @@ monitor_back_db_config( ber_str2bv( argv[ 1 ], 0, 1, &mi->mi_l ); } else { -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, INFO, - "line %d of file '%s' will be ignored\n", - lineno, fname, 0 ); -#else - Debug( LDAP_DEBUG_CONFIG, - "line %d of file '%s' will be ignored\n", - lineno, fname, 0 ); -#endif + return SLAP_CONF_UNKNOWN; } return( 0 ); diff --git a/servers/slapd/back-null/null.c b/servers/slapd/back-null/null.c index 94c097d341..7d9ba21ac6 100644 --- a/servers/slapd/back-null/null.c +++ b/servers/slapd/back-null/null.c @@ -92,9 +92,7 @@ null_back_db_config( /* anything else */ } else { - fprintf( stderr, -"%s: line %d: unknown directive \"%s\" in null database definition (ignored)\n", - fname, lineno, argv[0] ); + return SLAP_CONF_UNKNOWN; } return 0; diff --git a/servers/slapd/back-passwd/config.c b/servers/slapd/back-passwd/config.c index 487cabc8d8..cf985dfec8 100644 --- a/servers/slapd/back-passwd/config.c +++ b/servers/slapd/back-passwd/config.c @@ -66,9 +66,7 @@ passwd_back_db_config( /* anything else */ } else { - fprintf( stderr, -"%s: line %d: unknown directive \"%s\" in passwd database definition (ignored)\n", - fname, lineno, argv[0] ); + return SLAP_CONF_UNKNOWN; } return( 0 ); diff --git a/servers/slapd/back-perl/config.c b/servers/slapd/back-perl/config.c index 2541715d1e..bcd3b5b2e3 100644 --- a/servers/slapd/back-perl/config.c +++ b/servers/slapd/back-perl/config.c @@ -122,6 +122,7 @@ perl_back_db_config( } else if ( strcasecmp( argv[0], "filterSearchResults" ) == 0 ) { perl_back->pb_filter_search_results = 1; } else { + return_code = SLAP_CONF_UNKNOWN; /* * Pass it to Perl module if defined */ @@ -157,12 +158,7 @@ perl_back_db_config( } - /* if the module rejected it then we should reject it */ - if ( return_code != 0 ) { - fprintf( stderr, - "Unknown perl backend config: %s\n", argv[0]); - exit( EXIT_FAILURE ); - } + return return_code; } return 0; diff --git a/servers/slapd/back-shell/config.c b/servers/slapd/back-shell/config.c index ed1fc82fad..2a8c35a5d0 100644 --- a/servers/slapd/back-shell/config.c +++ b/servers/slapd/back-shell/config.c @@ -137,9 +137,7 @@ shell_back_db_config( /* anything else */ } else { - fprintf( stderr, -"%s: line %d: unknown directive \"%s\" in shell database definition (ignored)\n", - fname, lineno, argv[0] ); + return SLAP_CONF_UNKNOWN; } return 0; diff --git a/servers/slapd/back-sql/config.c b/servers/slapd/back-sql/config.c index 4508bef971..0b102815c6 100644 --- a/servers/slapd/back-sql/config.c +++ b/servers/slapd/back-sql/config.c @@ -325,9 +325,7 @@ backsql_db_config( BACKSQL_FAIL_IF_NO_MAPPING( si ) ? "yes" : "no", 0, 0 ); } else { - Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config (%s line %d): " - "unknown directive \"%s\" (ignored)\n", - fname, lineno, argv[ 0 ] ); + return SLAP_CONF_UNKNOWN; } return 0; diff --git a/servers/slapd/backover.c b/servers/slapd/backover.c index 386a78b422..6a36f7880b 100644 --- a/servers/slapd/backover.c +++ b/servers/slapd/backover.c @@ -77,7 +77,7 @@ over_db_config( if ( oi->oi_bd.bd_info->bi_db_config ) { rc = oi->oi_bd.bd_info->bi_db_config( &oi->oi_bd, fname, lineno, argc, argv ); - if ( rc ) return rc; + if ( rc != SLAP_CONF_UNKNOWN ) return rc; } bd = *be; @@ -86,7 +86,7 @@ over_db_config( if (on->on_bi.bi_db_config) { rc = on->on_bi.bi_db_config( &bd, fname, lineno, argc, argv ); - if ( rc ) break; + if ( rc != SLAP_CONF_UNKNOWN ) break; } } return rc; diff --git a/servers/slapd/config.c b/servers/slapd/config.c index cbfc9482ca..68c3c2ac1e 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -2470,45 +2470,35 @@ read_config( const char *fname, int depth ) /* pass anything else to the current backend info/db config routine */ } else { if ( bi != NULL ) { - if ( bi->bi_config == 0 ) { + if ( bi->bi_config && + ( rc = (*bi->bi_config)( bi, fname, lineno, cargc, cargv )) + != 0 && rc != SLAP_CONF_UNKNOWN ) return ( 1 ); #ifdef NEW_LOGGING - LDAP_LOG( CONFIG, INFO, - "%s: line %d: unknown directive \"%s\" inside " - "backend info definition (ignored).\n", - fname, lineno, cargv[0] ); + LDAP_LOG( CONFIG, INFO, + "%s: line %d: unknown directive \"%s\" inside " + "backend info definition (ignored).\n", + fname, lineno, cargv[0] ); #else - Debug( LDAP_DEBUG_ANY, + Debug( LDAP_DEBUG_ANY, "%s: line %d: unknown directive \"%s\" inside backend info definition (ignored)\n", - fname, lineno, cargv[0] ); + fname, lineno, cargv[0] ); #endif - } else { - if ( (*bi->bi_config)( bi, fname, lineno, cargc, cargv ) - != 0 ) - { - return( 1 ); - } - } } else if ( be != NULL ) { - if ( be->be_config == 0 ) { + if ( be->be_config && + ( rc = (*be->be_config)( be, fname, lineno, cargc, cargv )) + != 0 && rc != SLAP_CONF_UNKNOWN ) return ( 1 ); #ifdef NEW_LOGGING - LDAP_LOG( CONFIG, INFO, - "%s: line %d: uknown directive \"%s\" inside " - "backend database definition (ignored).\n", - fname, lineno, cargv[0] ); + LDAP_LOG( CONFIG, INFO, + "%s: line %d: unknown directive \"%s\" inside " + "backend database definition (ignored).\n", + fname, lineno, cargv[0] ); #else - Debug( LDAP_DEBUG_ANY, + Debug( LDAP_DEBUG_ANY, "%s: line %d: unknown directive \"%s\" inside backend database definition (ignored)\n", - fname, lineno, cargv[0] ); + fname, lineno, cargv[0] ); #endif - } else { - if ( (*be->be_config)( be, fname, lineno, cargc, cargv ) - != 0 ) - { - return( 1 ); - } - } } else { #ifdef NEW_LOGGING LDAP_LOG( CONFIG, INFO, diff --git a/servers/slapd/overlays/dyngroup.c b/servers/slapd/overlays/dyngroup.c index f5ced83990..a453c31abd 100644 --- a/servers/slapd/overlays/dyngroup.c +++ b/servers/slapd/overlays/dyngroup.c @@ -117,6 +117,8 @@ static int dyngroup_config( a2->ap_mem = ap.ap_mem; a2->ap_uri = ap.ap_uri; on->on_bi.bi_private = a2; + } else { + return SLAP_CONF_UNKNOWN; } return 0; } diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index e1eeb4588e..09b3730288 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -522,6 +522,8 @@ rwm_config( } else if (strcasecmp( argv[0], "suffixmassage" ) == 0 ) { rc = rwm_suffixmassage_config( be, fname, lineno, argc, argv ); + } else { + rc = SLAP_CONF_UNKNOWN; } return rc; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index ac4f84c110..1e0c0a18bc 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -108,6 +108,8 @@ LDAP_BEGIN_DECL /* psuedo error code indicating disconnect */ #define SLAPD_DISCONNECT (-2) +/* unknown config file directive */ +#define SLAP_CONF_UNKNOWN (-2) /* We assume "C" locale, that is US-ASCII */ #define ASCII_SPACE(c) ( (c) == ' ' )