From: hno <> Date: Fri, 8 Feb 2008 09:07:11 +0000 (+0000) Subject: make include support wildcards, and document the directive (copied from squid-2) X-Git-Tag: BASIC_TPROXY4~136 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=592a09dc9b13360455f8f52aa85bd82ae560384a;p=thirdparty%2Fsquid.git make include support wildcards, and document the directive (copied from squid-2) --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 785cfe3c36..75049a8ad1 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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 #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; } diff --git a/src/cf.data.pre b/src/cf.data.pre index 44ccd56290..c9c1ab52a4 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -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 -----------------------------------------------------------------------------