]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
make include support wildcards, and document the directive (copied from squid-2)
authorhno <>
Fri, 8 Feb 2008 09:07:11 +0000 (09:07 +0000)
committerhno <>
Fri, 8 Feb 2008 09:07:11 +0000 (09:07 +0000)
src/cache_cf.cc
src/cf.data.pre

index 785cfe3c364305ca2670ec69bc611e4f3c0b370b..75049a8ad1f7b53e5ddfcaebe0b2e6820ce85fb0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.539 2008/02/08 01:56:32 hno Exp $
+ * $Id: cache_cf.cc,v 1.540 2008/02/08 02:07:11 hno Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -46,6 +46,7 @@
 #include "Parsing.h"
 #include "MemBuf.h"
 #include "wordlist.h"
+#include <glob.h>
 
 #if SQUID_SNMP
 #include "snmp.h"
@@ -210,11 +211,20 @@ parseManyConfigFiles(char* files, int depth)
 {
     int error_count = 0;
     char* saveptr = NULL;
-    char* file = strwordtok(files, &saveptr);
-    while (file != NULL) {
-        error_count += parseOneConfigFile(file, depth);
-        file = strwordtok(NULL, &saveptr);
+    char *path;
+    glob_t globbuf;
+    int i;
+    memset(&globbuf, 0, sizeof(globbuf));
+    for (path = strwordtok(files, &saveptr); path; path = strwordtok(NULL, &saveptr)) {
+       if (glob(path, globbuf.gl_pathc ? GLOB_APPEND : 0, NULL, &globbuf) != 0) {
+           fatalf("Unable to find configuration file: %s: %s",
+               path, xstrerror());
+       }
+     }
+    for (i = 0; i < (int)globbuf.gl_pathc; i++) {
+       error_count += parseOneConfigFile(globbuf.gl_pathv[i], depth);
     }
+    globfree(&globbuf);
     return error_count;
 }
 
index 44ccd56290ce61c2e739d1b5ad6778a03c75f023..c9c1ab52a4eea774b87ce7ab830821f76b1c3abe 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.498 2008/02/08 01:56:32 hno Exp $
+# $Id: cf.data.pre,v 1.499 2008/02/08 02:07:11 hno Exp $
 #
 # SQUID Web Proxy Cache                http://www.squid-cache.org/
 # ----------------------------------------------------------
@@ -47,6 +47,21 @@ COMMENT_START
 
 COMMENT_END
 
+COMMENT_START
+  Configuration options can be included using the "include" directive.
+  Include takes a list of files to include. Quoting and wildcards is
+  supported.
+
+  For example,
+
+  include /path/to/included/file/squid.acl.config
+
+  Includes can be nested up to a hard-coded depth of 16 levels.
+  This arbitrary restriction is to prevent recursive include references
+  from causing Squid entering an infinite loop whilst trying to load
+  configuration files.
+COMMENT_END
+
 COMMENT_START
  OPTIONS FOR AUTHENTICATION
  -----------------------------------------------------------------------------