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

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



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

I think that's a good idea.
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.



--
 -- Howard Chu
 Chief Architect, Symas Corp.  http://www.symas.com
 Director, Highland Sun        http://highlandsun.com/hyc
 OpenLDAP Core Team            http://www.openldap.org/project/