Geoffrey Young wrote:
> 
> Andr� Malo wrote:
> 
>>* Geoffrey Young <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>>anyway, attached is a patch that makes <IfModule>, <IfDefine>,
>>
>>
>>I'd like to keep <IfDefine > possible. Simply because it's a very efficient
>>way to comment a whole part out (reliably, since one cannot specify an
>>empty -D argument). And it's in use out there.

ok, here is a new patch that excludes <IfDefine >.

also included is a patch (that applies on top of the other one) that fixes
broken <Limit> containers.  currently

<Limit GET

does not throw an error (note the missing final '>').

if people don't like the first idea but would like to fix <Limit> I can do
that separately as well.

HTH

--Geoff
Index: server/core.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/core.c,v
retrieving revision 1.252
diff -u -r1.252 core.c
--- server/core.c       21 Nov 2003 15:02:04 -0000      1.252
+++ server/core.c       9 Dec 2003 15:08:01 -0000
@@ -1552,6 +1552,24 @@
     return NULL;
 }
 
+/*
+ * Report a missing-'>' syntax error.
+ */
+static char *unclosed_directive(cmd_parms *cmd)
+{
+    return apr_pstrcat(cmd->pool, cmd->cmd->name,
+                       "> directive missing closing '>'", NULL);
+}
+
+/*
+ * Report a missing args in '<Foo >' syntax error.
+ */
+static char *missing_container_arg(cmd_parms *cmd)
+{
+    return apr_pstrcat(cmd->pool, cmd->cmd->name,
+                       "> directive requires additional arguments", NULL);
+}
+
 AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd,
                                                       void *dummy,
                                                       const char *arg)
@@ -1566,6 +1584,10 @@
         return err;
     }
 
+    if (!limited_methods[0]) {
+        return missing_container_arg(cmd);
+    }
+
     while (limited_methods[0]) {
         char *method = ap_getword_conf(cmd->pool, &limited_methods);
         int methnum;
@@ -1610,15 +1632,6 @@
 #define USE_ICASE 0
 #endif
 
-/*
- * Report a missing-'>' syntax error.
- */
-static char *unclosed_directive(cmd_parms *cmd)
-{
-    return apr_pstrcat(cmd->pool, cmd->cmd->name,
-                       "> directive missing closing '>'", NULL);
-}
-
 static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg)
 {
     const char *errmsg;
@@ -1642,6 +1655,10 @@
 
     arg = apr_pstrndup(cmd->pool, arg, endp - arg);
 
+    if (!arg[0]) {
+        return missing_container_arg(cmd);
+    }
+
     if (!arg) {
         if (thiscmd->cmd_data)
             return "<DirectoryMatch > block must specify a path";
@@ -1736,6 +1753,10 @@
 
     arg = apr_pstrndup(cmd->pool, arg, endp - arg);
 
+    if (!arg[0]) {
+        return missing_container_arg(cmd);
+    }
+
     cmd->path = ap_getword_conf(cmd->pool, &arg);
     cmd->override = OR_ALL|ACCESS_CONF;
 
@@ -1795,6 +1816,10 @@
 
     arg = apr_pstrndup(cmd->pool, arg, endp - arg);
 
+    if (!arg[0]) {
+        return missing_container_arg(cmd);
+    }
+
     cmd->path = ap_getword_conf(cmd->pool, &arg);
     /* Only if not an .htaccess file */
     if (!old_path) {
@@ -1860,6 +1885,10 @@
         arg++;
     }
 
+    if (!arg[0]) {
+        return missing_container_arg(cmd);
+    }
+
     found = ap_find_linked_module(arg);
 
     if ((!not && found) || (not && !found)) {
@@ -1948,6 +1977,10 @@
     }
 
     arg = apr_pstrndup(cmd->pool, arg, endp - arg);
+
+    if (!arg[0]) {
+        return missing_container_arg(cmd);
+    }
 
     /* FIXME: There's another feature waiting to happen here -- since you
         can now put multiple addresses/names on a single <VirtualHost>
--- server/core.c       2003-12-09 10:29:09.000000000 -0500
+++ server/core.c       2003-12-09 10:29:59.000000000 -0500
@@ -1574,7 +1574,8 @@
                                                       void *dummy,
                                                       const char *arg)
 {
-    const char *limited_methods = ap_getword(cmd->pool, &arg, '>');
+    const char *endp = ap_strrchr_c(arg, '>');
+    const char *limited_methods;
     void *tog = cmd->cmd->cmd_data;
     apr_int64_t limited = 0;
     const char *errmsg;
@@ -1584,6 +1585,12 @@
         return err;
     }
 
+    if (endp == NULL) {
+        return unclosed_directive(cmd);
+    }
+
+    limited_methods = apr_pstrndup(cmd->pool, arg, endp - arg);
+
     if (!limited_methods[0]) {
         return missing_container_arg(cmd);
     }

Reply via email to