On Mon, May 08, 2006 at 10:12:58AM -0400, Jim Jagielski wrote:
> That is an unexpected and unwelcome regression. 

Yep, my bad, I never had such a block in my testing largely because I
didn't even know 1.3.x had that feature, *sigh*, it's not even
documented and I can't see it in a changelog and it didn't have that
functionality when I first wrote that patch. 

> If I had known about it I would have vetoed the patch. I'd be willing
> to actually release a 1.3.36 simply to address that.

Patch attached, courtesy of Matthijs van der Klip. Or simply revert the
whole change.

-- 
Colm MacCárthaigh                        Public Key: [EMAIL PROTECTED]
diff -Bru apache_1.3.35/src/main/http_config.c 
apache_1.3.35-include/src/main/http_config.c
--- apache_1.3.35/src/main/http_config.c        2006-05-05 12:00:14.000000000 
+0200
+++ apache_1.3.35-include/src/main/http_config.c        2006-05-05 
12:00:39.000000000 +0200
@@ -1214,16 +1214,19 @@
     return strcmp(f1->fname,f2->fname);
 }
 
-CORE_EXPORT(void) ap_process_include_config(server_rec *s, char *fname, pool 
*p, pool *ptemp, 
+CORE_EXPORT(void) ap_process_include_config(server_rec *s, char *fname, pool 
*p, pool *ptemp,
                cmd_parms *parms)
 {
     const char *errmsg;
     struct stat finfo;
-
+    int ispatt;
     fname = ap_server_root_relative(p, fname);
 
-    if (stat(fname, &finfo) == -1)
+    if (!(strcmp(fname, ap_server_root_relative(p, RESOURCE_CONFIG_FILE))) ||
+       !(strcmp(fname, ap_server_root_relative(p, ACCESS_CONFIG_FILE)))) {
+       if (stat(fname, &finfo) == -1)
            return;
+    }
 
     /* 
      * here we want to check if the candidate file is really a
@@ -1231,12 +1234,36 @@
      * horrible loops).  If so, let's recurse and toss it back into
      * the function.
      */
-    if (ap_is_rdirectory(fname)) {
+    ispatt = ap_is_fnmatch(fname);
+    if (ispatt || ap_is_rdirectory(fname)) {
        DIR *dirp;
        struct DIR_TYPE *dir_entry;
        int current;
        array_header *candidates = NULL;
        fnames *fnew;
+       char *path = ap_pstrdup(p,fname);
+       char *pattern = NULL;
+
+        if(ispatt && (pattern = strrchr(path, '/')) != NULL) {
+            *pattern++ = '\0';
+            if (ap_is_fnmatch(path)) {
+                fprintf(stderr, "%s: wildcard patterns not allowed in Include "
+                        "%s\n", ap_server_argv0, fname);
+                exit(1);
+            }
+
+            if (!ap_is_rdirectory(path)){ 
+                fprintf(stderr, "%s: Include directory '%s' not found",
+                        ap_server_argv0, path);
+                exit(1);
+            }
+            if (!ap_is_fnmatch(pattern)) {
+                fprintf(stderr, "%s: must include a wildcard pattern "
+                        "for Include %s\n", ap_server_argv0, fname);
+                exit(1);
+            }
+        }
+
 
        /*
         * first course of business is to grok all the directory
@@ -1244,11 +1271,15 @@
         * for this.
         */
        fprintf(stderr, "Processing config directory: %s\n", fname);
+#ifdef NETWARE
        dirp = ap_popendir(p, fname);
+#else
+       dirp = ap_popendir(p, path);
+#endif
        if (dirp == NULL) {
            perror("fopen");
            fprintf(stderr, "%s: could not open config directory %s\n",
-               ap_server_argv0, fname);
+               ap_server_argv0, path);
 #ifdef NETWARE
            clean_parent_exit(1);
 #else
@@ -1259,9 +1290,11 @@
        while ((dir_entry = readdir(dirp)) != NULL) {
            /* strip out '.' and '..' */
            if (strcmp(dir_entry->d_name, ".") &&
-               strcmp(dir_entry->d_name, "..")) {
+               strcmp(dir_entry->d_name, "..") &&
+                (!ispatt ||
+                 !ap_fnmatch(pattern,dir_entry->d_name, FNM_PERIOD)) ) {
                fnew = (fnames *) ap_push_array(candidates);
-               fnew->fname = ap_make_full_path(p, fname, dir_entry->d_name);
+               fnew->fname = ap_make_full_path(p, path, dir_entry->d_name);
            }
        }
        ap_pclosedir(p, dirp);

Reply via email to