From 87d7ca895730d549a63785fa644eeb3f733d7341 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Wed, 4 May 2005 18:46:45 +0000 Subject: [PATCH] ITS#3705: bailout if unknown config directive is found --- servers/slapd/config.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/servers/slapd/config.c b/servers/slapd/config.c index b91bf6bb40..399014a6b7 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -43,6 +43,13 @@ #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 */ } } -- 2.39.5