httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 22299] New: - ITERATE and ITERATE2 prototypes incorrectly handle DECLINE_CMD
Date Mon, 11 Aug 2003 13:20:59 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22299>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22299

ITERATE and ITERATE2 prototypes incorrectly handle DECLINE_CMD

           Summary: ITERATE and ITERATE2 prototypes incorrectly handle
                    DECLINE_CMD
           Product: Apache httpd-2.0
           Version: HEAD
          Platform: Other
               URL: http://marc.theaimsgroup.com/?l=apache-httpd-
                    dev&m=106011202900899&w=2
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: Enhancement
          Priority: Other
         Component: Core
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: geoff@apache.org


this bug was first reported to httpd-dev

http://marc.theaimsgroup.com/?l=apache-httpd-dev&m=106011202900899&w=2

currently, using DECLINE_CMD to override config directives has a limitation -
you can't override ITERATE or ITERATE2 prototypes properly. what ends up
happening is that DECLINE_CMD is returned for the first argument, but then
Apache skips over your module for all subsequent arguments.  the only way around
this (that I was able to figure out, that is) is to use RAW_ARGS when overriding
these prototypes and do the parsing yourself.

  attached is a patch that fixes this, keeping ITERATE and ITERATE2 focused on
the current module until the argument list is exhausted.

--Geoff



Index: server/config.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/config.c,v
retrieving revision 1.164
diff -u -r1.164 config.c
--- server/config.c	17 Feb 2003 07:04:50 -0000	1.164
+++ server/config.c	5 Aug 2003 19:26:59 -0000
@@ -697,7 +697,7 @@
                               void *mconfig, const char *args)
 {
     char *w, *w2, *w3;
-    const char *errmsg;
+    const char *errmsg = NULL;
 
     if ((parms->override & cmd->req_override) == 0)
         return apr_pstrcat(parms->pool, cmd->name, " not allowed here", NULL);
@@ -797,11 +797,14 @@
 
     case ITERATE:
         while (*(w = ap_getword_conf(parms->pool, &args)) != '\0') {
-            if ((errmsg = cmd->AP_TAKE1(parms, mconfig, w)))
+
+            errmsg = cmd->AP_TAKE1(parms, mconfig, w);
+
+            if (errmsg && strcmp(errmsg, DECLINE_CMD) != 0)
                 return errmsg;
         }
 
-        return NULL;
+        return errmsg;
 
     case ITERATE2:
         w = ap_getword_conf(parms->pool, &args);
@@ -812,11 +815,14 @@
                                cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL);
 
         while (*(w2 = ap_getword_conf(parms->pool, &args)) != '\0') {
-            if ((errmsg = cmd->AP_TAKE2(parms, mconfig, w, w2)))
+
+            errmsg = cmd->AP_TAKE2(parms, mconfig, w, w2);
+
+            if (errmsg && strcmp(errmsg, DECLINE_CMD) != 0)
                 return errmsg;
         }
 
-        return NULL;
+        return errmsg;
 
     case FLAG:
         w = ap_getword_conf(parms->pool, &args);

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message