]> git.sur5r.net Git - openldap/commitdiff
Cleanup unknown config directive handling.
authorHoward Chu <hyc@openldap.org>
Sun, 7 Dec 2003 07:07:00 +0000 (07:07 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 7 Dec 2003 07:07:00 +0000 (07:07 +0000)
16 files changed:
servers/slapd/back-bdb/config.c
servers/slapd/back-dnssrv/config.c
servers/slapd/back-ldap/config.c
servers/slapd/back-ldbm/config.c
servers/slapd/back-meta/config.c
servers/slapd/back-monitor/init.c
servers/slapd/back-null/null.c
servers/slapd/back-passwd/config.c
servers/slapd/back-perl/config.c
servers/slapd/back-shell/config.c
servers/slapd/back-sql/config.c
servers/slapd/backover.c
servers/slapd/config.c
servers/slapd/overlays/dyngroup.c
servers/slapd/overlays/rwm.c
servers/slapd/slap.h

index c05df616d33f47e8f9672d41bea54d8da6a237be..b3df31e32248c2bdf2f210336d61790929571c56 100644 (file)
@@ -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;
index 7a6cb3318da7c845d9cef4025e0e6a638cbe0be4..f3ec06c2fe45b9a8846e511975b689313a71c0d3 100644 (file)
@@ -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;
 }
index 1b01ba800b800ee256c0ea013575d002726a65a9..e09113421be86a2495d3964f30836c845ebe4daa 100644 (file)
@@ -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;
 }
index 71259aa35b34fcdc2123c05bd6ffe0150804aad3..6873f4950cc7eaf47dbf5820c13a1c0b7ae416ed 100644 (file)
@@ -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;
index 97729874278f022a255f092885d132314461cb10..443e1a71d3d6b2bef4625b81d3bbe791e0dd20f6 100644 (file)
@@ -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;
 }
index 3ff3eb95107cba5e77f6d2ae430bf9fe3aa91294..c6dad69a99ffe85e78e4d0625413ebeb951b7567 100644 (file)
@@ -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 );
index 94c097d3418a1f95add08d7c2db0917de78cd1fa..7d9ba21ac60f5374e3dc87f60b8255d3b8ad15b3 100644 (file)
@@ -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;
index 487cabc8d82a5c6cacc3b71fd1e6107378e9745e..cf985dfec89068fc98a732bb6b245a0e601882c9 100644 (file)
@@ -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 );
index 2541715d1e336f4a1ceadeb1f0198f688097b8a4..bcd3b5b2e30daa0245266a403c5b941531121a68 100644 (file)
@@ -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;
index ed1fc82fada83ac125994eae86cfe482ffcaf643..2a8c35a5d0ff1faa2c369a293bd3719b7a21318d 100644 (file)
@@ -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;
index 4508bef971ccc5afe81e018f154bd6d30584908a..0b102815c6457a01d70fe8c06e196d80d28d190a 100644 (file)
@@ -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;
index 386a78b422d930a6dd04b2fdb795143d13efbab0..6a36f7880b173092abf8e2131fb9cc59b0e233e6 100644 (file)
@@ -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;
index cbfc9482ca0ad0b4017b9da8197eba52b976bc05..68c3c2ac1e7a565b9538ca97a119ff69cf1888bc 100644 (file)
@@ -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, 
index f5ced8399078c2731d3aa3af532b1bfe58d15a02..a453c31abd20ca0b2234b57e0692e328ef91f8b9 100644 (file)
@@ -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;
 }
index e1eeb4588e3194a03d9145c07c6b8cd2b2315500..09b37302882b7aa644ba26c1d8ae89175ac45c51 100644 (file)
@@ -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;
index ac4f84c1101fd0f5e12455ff4ab61cb876134e7a..1e0c0a18bc65bf8781a985d5e5c4c8df535f0ab7 100644 (file)
@@ -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) == ' ' )