]> git.sur5r.net Git - openldap/commitdiff
ITS#3705: bailout if unknown config directive is found
authorPierangelo Masarati <ando@openldap.org>
Wed, 4 May 2005 18:46:45 +0000 (18:46 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 4 May 2005 18:46:45 +0000 (18:46 +0000)
servers/slapd/config.c

index b91bf6bb40ef7c23d90b7d4179ade58ddb0f5433..399014a6b763b644a30a9edfb8ca6e0be8941394 100644 (file)
 
 #define ARGS_STEP      512
 
+/*
+ * ITS#3705: bail out if unknown config directives appear in slapd.conf
+ */
+#ifdef LDAP_DEVEL
+#define SLAPD_CONF_UNKNOWN_BAILOUT
+#endif /* LDAP_DEVEL */
+
 /*
  * defaults for various global variables
  */
@@ -607,10 +614,16 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf)
                        if ( rc ) {
                                switch(rc) {
                                case SLAP_CONF_UNKNOWN:
+#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
+                                       Debug(LDAP_DEBUG_CONFIG, "%s: "
+                                               "unknown directive <%s> inside backend info definition\n",
+                                               c->log, *c->argv, 0);
+#else /* !SLAPD_CONF_UNKNOWN_BAILOUT */
                                        Debug(LDAP_DEBUG_CONFIG, "%s: "
                                                "unknown directive <%s> inside backend info definition (ignored)\n",
                                                c->log, *c->argv, 0);
                                        continue;
+#endif /* !SLAPD_CONF_UNKNOWN_BAILOUT */
                                default:
                                        rc = 1;
                                        goto leave;
@@ -632,11 +645,18 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf)
                        if ( rc ) {
                                switch(rc) {
                                case SLAP_CONF_UNKNOWN:
+#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
+                                       Debug( LDAP_DEBUG_CONFIG, "%s: "
+                                               "unknown directive <%s> inside backend database "
+                                               "definition\n",
+                                               c->log, *c->argv, 0);
+#else /* !SLAPD_CONF_UNKNOWN_BAILOUT */
                                        Debug( LDAP_DEBUG_CONFIG, "%s: "
                                                "unknown directive <%s> inside backend database "
                                                "definition (ignored)\n",
                                                c->log, *c->argv, 0);
                                        continue;
+#endif /* !SLAPD_CONF_UNKNOWN_BAILOUT */
                                default:
                                        rc = 1;
                                        goto leave;
@@ -648,10 +668,16 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf)
                        if ( rc ) {
                                switch(rc) {
                                case SLAP_CONF_UNKNOWN:
+#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
+                                       Debug( LDAP_DEBUG_CONFIG, "%s: "
+                                               "unknown directive <%s> inside global database definition\n",
+                                               c->log, *c->argv, 0);
+#else /* !SLAPD_CONF_UNKNOWN_BAILOUT */
                                        Debug( LDAP_DEBUG_CONFIG, "%s: "
                                                "unknown directive <%s> inside global database definition (ignored)\n",
                                                c->log, *c->argv, 0);
                                        continue;
+#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
                                default:
                                        rc = 1;
                                        goto leave;
@@ -659,11 +685,18 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf)
                        }
                        
                } else {
+#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
+                       Debug(LDAP_DEBUG_CONFIG, "%s: "
+                               "unknown directive <%s> outside backend info and database definitions\n",
+                               c->log, *c->argv, 0);
+                       rc = 1;
+                       goto leave;
+#else /* !SLAPD_CONF_UNKNOWN_BAILOUT */
                        Debug(LDAP_DEBUG_CONFIG, "%s: "
                                "unknown directive <%s> outside backend info and database definitions (ignored)\n",
                                c->log, *c->argv, 0);
                        continue;
-
+#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
                }
        }