[Date Prev][Date Next] [Chronological] [Thread] [Top]

More strict config parsing (Was: (ITS#3901) slapd segmentation fault if directive starts with whitespace)



I'm keen to making extra args be treated as errors unless allowed by the
configure statement syntax.  See the patch below.

Comments?

p.

=========>
diff -u -r1.417 config.c
--- servers/slapd/config.c      25 Jul 2005 18:48:24 -0000      1.417
+++ servers/slapd/config.c      28 Jul 2005 16:23:49 -0000
@@ -136,9 +136,19 @@
                return(ARG_BAD_CONF);
        }
        if(Conf->max_args && (c->argc > Conf->max_args)) {
-               sprintf( c->msg, "<%s> extra cruft after <%s> ignored",
+               char    *ignored = " ignored";
+
+               sprintf( c->msg, "<%s> extra cruft after <%s>",
                        c->argv[0], Conf->what );
-               Debug(LDAP_DEBUG_CONFIG, "%s: %s\n", c->log, c->msg, 0 );
+
+#ifdef LDAP_DEVEL
+               ignored = "";
+#endif /* LDAP_DEVEL */
+               Debug(LDAP_DEBUG_CONFIG, "%s: %s%s.\n",
+                               c->log, c->msg, ignored );
+#ifdef LDAP_DEVEL
+               return(ARG_BAD_CONF);
+#endif /* LDAP_DEVEL */
        }
        if((arg_type & ARG_DB) && !c->be) {
                sprintf( c->msg, "<%s> only allowed within database
declaration",
<==========

> It appears that extra args after the "database" directives are ignored, so
> your change resulted in omitting the "suffix" directive.

-- 
Pierangelo Masarati
mailto:pierangelo.masarati@sys-net.it


    SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497