]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/cache_cf.cc
50bcb536aacddcc80046eeb3617a51bc3e714d18
3 * $Id: cache_cf.cc,v 1.455 2004/10/15 21:10:44 hno Exp $
5 * DEBUG: section 3 Configuration File Parsing
6 * AUTHOR: Harvest Derived
8 * SQUID Web Proxy Cache http://www.squid-cache.org/
9 * ----------------------------------------------------------
11 * Squid is the result of efforts by numerous individuals from
12 * the Internet community; see the CONTRIBUTORS file for full
13 * details. Many organizations have provided support for Squid's
14 * development; see the SPONSORS file for full details. Squid is
15 * Copyrighted (C) 2001 by the Regents of the University of
16 * California; see the COPYRIGHT file for full details. Squid
17 * incorporates software developed and/or copyrighted by other
18 * sources; see the CREDITS file for full details.
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
37 #include "authenticate.h"
38 #include "AuthConfig.h"
39 #include "AuthScheme.h"
42 #include "ConfigParser.h"
44 #include "StoreFileSystem.h"
50 #include "ESIParser.h"
55 static const char *const T_SECOND_STR
= "second";
56 static const char *const T_MINUTE_STR
= "minute";
57 static const char *const T_HOUR_STR
= "hour";
58 static const char *const T_DAY_STR
= "day";
59 static const char *const T_WEEK_STR
= "week";
60 static const char *const T_FORTNIGHT_STR
= "fortnight";
61 static const char *const T_MONTH_STR
= "month";
62 static const char *const T_YEAR_STR
= "year";
63 static const char *const T_DECADE_STR
= "decade";
65 static const char *const B_BYTES_STR
= "bytes";
66 static const char *const B_KBYTES_STR
= "KB";
67 static const char *const B_MBYTES_STR
= "MB";
68 static const char *const B_GBYTES_STR
= "GB";
70 static const char *const list_sep
= ", \t\n\r";
72 static void parse_logformat(logformat
** logformat_definitions
);
73 static void parse_access_log(customlog
** customlog_definitions
);
74 static int check_null_access_log(customlog
*customlog_definitions
);
76 static void dump_logformat(StoreEntry
* entry
, const char *name
, logformat
* definitions
);
77 static void dump_access_log(StoreEntry
* entry
, const char *name
, customlog
* definitions
);
78 static void free_logformat(logformat
** definitions
);
79 static void free_access_log(customlog
** definitions
);
84 static void update_maxobjsize(void);
85 static void configDoConfigure(void);
86 static void parse_refreshpattern(refresh_t
**);
87 static int parseTimeUnits(const char *unit
);
88 static void parseTimeLine(time_t * tptr
, const char *units
);
89 static void parse_ushort(u_short
* var
);
90 static void parse_string(char **);
91 static void default_all(void);
92 static void defaults_if_none(void);
93 static int parse_line(char *);
94 static void parseBytesLine(size_t * bptr
, const char *units
);
95 static size_t parseBytesUnits(const char *unit
);
96 static void free_all(void);
97 void requirePathnameExists(const char *name
, const char *path
);
98 static OBJH dump_config
;
100 static void dump_http_header_access(StoreEntry
* entry
, const char *name
, header_mangler header
[]);
101 static void parse_http_header_access(header_mangler header
[]);
102 static void free_http_header_access(header_mangler header
[]);
103 static void dump_http_header_replace(StoreEntry
* entry
, const char *name
, header_mangler header
[]);
104 static void parse_http_header_replace(header_mangler
* header
);
105 static void free_http_header_replace(header_mangler
* header
);
107 static void parse_denyinfo(acl_deny_info_list
** var
);
108 static void dump_denyinfo(StoreEntry
* entry
, const char *name
, acl_deny_info_list
* var
);
109 static void free_denyinfo(acl_deny_info_list
** var
);
111 static void parse_sockaddr_in_list(sockaddr_in_list
**);
112 static void dump_sockaddr_in_list(StoreEntry
*, const char *, const sockaddr_in_list
*);
113 static void free_sockaddr_in_list(sockaddr_in_list
**);
114 static int check_null_sockaddr_in_list(const sockaddr_in_list
*);
115 #endif /* CURRENTLY_UNUSED */
116 static void parse_http_port_list(http_port_list
**);
117 static void dump_http_port_list(StoreEntry
*, const char *, const http_port_list
*);
118 static void free_http_port_list(http_port_list
**);
120 static int check_null_http_port_list(const http_port_list
*);
123 static void parse_https_port_list(https_port_list
**);
124 static void dump_https_port_list(StoreEntry
*, const char *, const https_port_list
*);
125 static void free_https_port_list(https_port_list
**);
127 static int check_null_https_port_list(const https_port_list
*);
130 static void parse_b_size_t(size_t * var
);
135 fatalf("Bungled %s line %d: %s",
136 cfg_filename
, config_lineno
, config_input_line
);
140 wordlistDestroy(wordlist
** list
)
144 while ((w
= *list
) != NULL
) {
147 memFree(w
, MEM_WORDLIST
);
154 wordlistAdd(wordlist
** list
, const char *key
)
157 list
= &(*list
)->next
;
159 *list
= static_cast<wordlist
*>(memAllocate(MEM_WORDLIST
));
161 (*list
)->key
= xstrdup(key
);
163 (*list
)->next
= NULL
;
169 wordlistJoin(wordlist
** list
, wordlist
** wl
)
172 list
= &(*list
)->next
;
180 wordlistAddWl(wordlist
** list
, wordlist
* wl
)
183 list
= &(*list
)->next
;
185 for (; wl
; wl
= wl
->next
, list
= &(*list
)->next
) {
186 *list
= static_cast<wordlist
*>(memAllocate(MEM_WORDLIST
));
187 (*list
)->key
= xstrdup(wl
->key
);
188 (*list
)->next
= NULL
;
193 wordlistCat(const wordlist
* w
, MemBuf
* mb
)
196 memBufPrintf(mb
, "%s\n", w
->key
);
202 wordlistDup(const wordlist
* w
)
207 wordlistAdd(&D
, w
->key
);
215 * These functions is the same as atoi/l/f, except that they check for errors
219 xatol(const char *token
)
222 long ret
= strtol(token
, &end
, 10);
224 if (ret
== 0 && end
== token
)
231 xatoi(const char *token
)
237 xatof(const char *token
)
240 double ret
= strtod(token
, &end
);
242 if (ret
== 0 && end
== token
)
251 char *token
= strtok(NULL
, w_space
);
257 if (sscanf(token
, "%d", &i
) != 1)
264 update_maxobjsize(void)
269 for (i
= 0; i
< Config
.cacheSwap
.n_configured
; i
++) {
270 assert (Config
.cacheSwap
.swapDirs
[i
]);
272 if (Config
.cacheSwap
.swapDirs
[i
]->max_objsize
> ms
)
273 ms
= Config
.cacheSwap
.swapDirs
[i
]->max_objsize
;
276 store_maxobjsize
= ms
;
280 SetConfigFilename(char const *file_name
, bool is_pipe
)
282 cfg_filename
= file_name
;
287 cfg_filename
= file_name
+ 1;
288 else if ((token
= strrchr(cfg_filename
, '/')))
289 cfg_filename
= token
+ 1;
293 parseConfigFile(const char *file_name
)
303 if (file_name
[0] == '!' || file_name
[0] == '|') {
304 fp
= popen(file_name
+ 1, "r");
307 fp
= fopen(file_name
, "r");
311 fatalf("Unable to open configuration file: %s: %s",
312 file_name
, xstrerror());
316 setmode(fileno(fp
), O_TEXT
);
320 SetConfigFilename(file_name
, bool(is_pipe
));
322 memset(config_input_line
, '\0', BUFSIZ
);
326 while (fgets(config_input_line
, BUFSIZ
, fp
)) {
329 if ((token
= strchr(config_input_line
, '\n')))
332 if (strncmp(config_input_line
, "#line ", 6) == 0) {
333 static char new_file_name
[1024];
335 static char new_lineno
;
336 token
= config_input_line
+ 6;
337 new_lineno
= strtol(token
, &file
, 0) - 1;
340 continue; /* Not a valid #line directive, may be a comment */
342 while (*file
&& isspace((unsigned char) *file
))
347 continue; /* Not a valid #line directive, may be a comment */
349 xstrncpy(new_file_name
, file
+ 1, sizeof(new_file_name
));
351 if ((token
= strchr(new_file_name
, '"')))
354 cfg_filename
= new_file_name
;
356 #if PROBABLY_NOT_WANTED_HERE
358 SetConfigFilename(cfg_filename
, false);
364 config_lineno
= new_lineno
;
367 if (config_input_line
[0] == '#')
370 if (config_input_line
[0] == '\0')
373 debug(3, 5) ("Processing: '%s'\n", config_input_line
);
375 tmp_line
= xstrdup(config_input_line
);
377 if (!parse_line(tmp_line
)) {
378 debug(3, 0) ("parseConfigFile: '%s' line %d unrecognized: '%s'\n",
389 int ret
= pclose(fp
);
392 fatalf("parseConfigFile: '%s' failed with exit code %d\n", file_name
, ret
);
399 cachemgrRegister("config",
400 "Current Squid Configuration",
407 configDoConfigure(void)
409 memset(&Config2
, '\0', sizeof(SquidConfig2
));
410 /* init memory as early as possible */
414 if (Config
.cacheSwap
.swapDirs
== NULL
)
415 fatal("No cache_dir's specified in config file");
417 /* calculate Config.Swap.maxSize */
420 if (0 == Config
.Swap
.maxSize
)
421 /* people might want a zero-sized cache on purpose */
423 else if (Config
.Swap
.maxSize
< (Config
.memMaxSize
>> 10))
424 debug(3, 0) ("WARNING cache_mem is larger than total disk cache space!\n");
426 if (Config
.Announce
.period
> 0) {
427 Config
.onoff
.announce
= 1;
428 } else if (Config
.Announce
.period
< 1) {
429 Config
.Announce
.period
= 86400 * 365; /* one year */
430 Config
.onoff
.announce
= 0;
434 if (Config
.dnsChildren
< 1)
435 fatal("No dnsservers allocated");
439 if (Config
.Program
.redirect
) {
440 if (Config
.redirectChildren
< 1) {
441 Config
.redirectChildren
= 0;
442 wordlistDestroy(&Config
.Program
.redirect
);
446 if (Config
.appendDomain
)
447 if (*Config
.appendDomain
!= '.')
448 fatal("append_domain must begin with a '.'");
450 if (Config
.errHtmlText
== NULL
)
451 Config
.errHtmlText
= xstrdup(null_string
);
455 snprintf(ThisCache
, sizeof(ThisCache
), "%s (%s)",
457 full_appname_string
);
460 * the extra space is for loop detection in client_side.c -- we search
461 * for substrings in the Via header.
463 snprintf(ThisCache2
, sizeof(ThisCache
), " %s (%s)",
465 full_appname_string
);
467 if (!Config
.udpMaxHitObjsz
|| Config
.udpMaxHitObjsz
> SQUID_UDP_SO_SNDBUF
)
468 Config
.udpMaxHitObjsz
= SQUID_UDP_SO_SNDBUF
;
470 if (Config
.appendDomain
)
471 Config
.appendDomainLen
= strlen(Config
.appendDomain
);
473 Config
.appendDomainLen
= 0;
475 safe_free(debug_options
)
476 debug_options
= xstrdup(Config
.debugOptions
);
478 if (Config
.retry
.maxtries
> 10)
479 fatal("maximum_single_addr_tries cannot be larger than 10");
481 if (Config
.retry
.maxtries
< 1) {
482 debug(3, 0) ("WARNING: resetting 'maximum_single_addr_tries to 1\n");
483 Config
.retry
.maxtries
= 1;
486 requirePathnameExists("MIME Config Table", Config
.mimeTablePathname
);
489 requirePathnameExists("cache_dns_program", Config
.Program
.dnsserver
);
493 requirePathnameExists("unlinkd_program", Config
.Program
.unlinkd
);
496 if (Config
.Program
.redirect
)
497 requirePathnameExists("redirect_program", Config
.Program
.redirect
->key
);
499 requirePathnameExists("Icon Directory", Config
.icons
.directory
);
501 requirePathnameExists("Error Directory", Config
.errorDirectory
);
508 for (R
= Config
.Refresh
; R
; R
= R
->next
)
510 if (!R
->flags
.override_expire
)
513 debug(22, 1) ("WARNING: use of 'override-expire' in 'refresh_pattern' violates HTTP\n");
518 for (R
= Config
.Refresh
; R
; R
= R
->next
)
520 if (!R
->flags
.override_lastmod
)
523 debug(22, 1) ("WARNING: use of 'override-lastmod' in 'refresh_pattern' violates HTTP\n");
531 Config
.onoff
.via
= 1;
534 if (!Config
.onoff
.via
)
535 debug(22, 1) ("WARNING: HTTP requires the use of Via\n");
539 if (Config
.Wais
.relayHost
) {
540 if (Config
.Wais
._peer
)
541 cbdataFree(Config
.Wais
._peer
);
543 CBDATA_INIT_TYPE_FREECB(peer
, peerDestroy
);
545 Config
.Wais
._peer
= cbdataAlloc(peer
);
547 Config
.Wais
._peer
->host
= xstrdup(Config
.Wais
.relayHost
);
549 Config
.Wais
._peer
->http_port
= Config
.Wais
.relayPort
;
552 if (aclPurgeMethodInUse(Config
.accessList
.http
))
553 Config2
.onoff
.enable_purge
= 1;
555 if (geteuid() == 0) {
556 if (NULL
!= Config
.effectiveUser
) {
558 struct passwd
*pwd
= getpwnam(Config
.effectiveUser
);
562 * Andres Kroonmaa <andre@online.ee>:
563 * Some getpwnam() implementations (Solaris?) require
564 * an available FD < 256 for opening a FILE* to the
567 * This should be safe at startup, but might still fail
568 * during reconfigure.
570 fatalf("getpwnam failed to find userid for effective user '%s'",
571 Config
.effectiveUser
);
573 Config2
.effectiveUserID
= pwd
->pw_uid
;
575 Config2
.effectiveGroupID
= pwd
->pw_gid
;
578 Config2
.effectiveUserID
= geteuid();
579 Config2
.effectiveGroupID
= getegid();
582 if (NULL
!= Config
.effectiveGroup
) {
584 struct group
*grp
= getgrnam(Config
.effectiveGroup
);
587 fatalf("getgrnam failed to find groupid for effective group '%s'",
588 Config
.effectiveGroup
);
590 Config2
.effectiveGroupID
= grp
->gr_gid
;
593 urlExtMethodConfigure();
596 Config
.ssl_client
.sslContext
= sslCreateClientContext(Config
.ssl_client
.cert
, Config
.ssl_client
.key
, Config
.ssl_client
.version
, Config
.ssl_client
.cipher
, Config
.ssl_client
.options
, Config
.ssl_client
.flags
, Config
.ssl_client
.cafile
, Config
.ssl_client
.capath
);
600 /* Parse a time specification from the config file. Store the
601 * result in 'tptr', after converting it to 'units' */
603 parseTimeLine(time_t * tptr
, const char *units
)
610 if ((u
= parseTimeUnits(units
)) == 0)
613 if ((token
= strtok(NULL
, w_space
)) == NULL
)
618 m
= u
; /* default to 'units' if none specified */
622 else if ((token
= strtok(NULL
, w_space
)) == NULL
)
623 debug(3, 0) ("WARNING: No units on '%s', assuming %f %s\n",
624 config_input_line
, d
, units
);
625 else if ((m
= parseTimeUnits(token
)) == 0)
628 *tptr
= static_cast<time_t> (m
* d
/ u
);
632 parseTimeUnits(const char *unit
)
634 if (!strncasecmp(unit
, T_SECOND_STR
, strlen(T_SECOND_STR
)))
637 if (!strncasecmp(unit
, T_MINUTE_STR
, strlen(T_MINUTE_STR
)))
640 if (!strncasecmp(unit
, T_HOUR_STR
, strlen(T_HOUR_STR
)))
643 if (!strncasecmp(unit
, T_DAY_STR
, strlen(T_DAY_STR
)))
646 if (!strncasecmp(unit
, T_WEEK_STR
, strlen(T_WEEK_STR
)))
649 if (!strncasecmp(unit
, T_FORTNIGHT_STR
, strlen(T_FORTNIGHT_STR
)))
652 if (!strncasecmp(unit
, T_MONTH_STR
, strlen(T_MONTH_STR
)))
655 if (!strncasecmp(unit
, T_YEAR_STR
, strlen(T_YEAR_STR
)))
656 return static_cast<int>(86400 * 365.2522);
658 if (!strncasecmp(unit
, T_DECADE_STR
, strlen(T_DECADE_STR
)))
659 return static_cast<int>(86400 * 365.2522 * 10);
661 debug(3, 1) ("parseTimeUnits: unknown time unit '%s'\n", unit
);
667 parseBytesLine(size_t * bptr
, const char *units
)
674 if ((u
= parseBytesUnits(units
)) == 0)
677 if ((token
= strtok(NULL
, w_space
)) == NULL
)
680 if (strcmp(token
, "none") == 0 || strcmp(token
, "-1") == 0) {
681 *bptr
= static_cast<size_t>(-1);
687 m
= u
; /* default to 'units' if none specified */
691 else if ((token
= strtok(NULL
, w_space
)) == NULL
)
692 debug(3, 0) ("WARNING: No units on '%s', assuming %f %s\n",
693 config_input_line
, d
, units
);
694 else if ((m
= parseBytesUnits(token
)) == 0)
697 *bptr
= static_cast<size_t>(m
* d
/ u
);
699 if (static_cast<double>(*bptr
) != m
* d
/ u
)
704 parseBytesUnits(const char *unit
)
706 if (!strncasecmp(unit
, B_BYTES_STR
, strlen(B_BYTES_STR
)))
709 if (!strncasecmp(unit
, B_KBYTES_STR
, strlen(B_KBYTES_STR
)))
712 if (!strncasecmp(unit
, B_MBYTES_STR
, strlen(B_MBYTES_STR
)))
715 if (!strncasecmp(unit
, B_GBYTES_STR
, strlen(B_GBYTES_STR
)))
718 debug(3, 1) ("parseBytesUnits: unknown bytes unit '%s'\n", unit
);
723 /*****************************************************************************
725 *****************************************************************************/
728 dump_acl(StoreEntry
* entry
, const char *name
, ACL
* ae
)
734 debug(3, 3) ("dump_acl: %s %s\n", name
, ae
->name
);
735 storeAppendPrintf(entry
, "%s %s %s ",
739 v
= w
= ae
->dumpGeneric();
742 debug(3, 3) ("dump_acl: %s %s %s\n", name
, ae
->name
, v
->key
);
743 storeAppendPrintf(entry
, "%s ", v
->key
);
747 storeAppendPrintf(entry
, "\n");
756 ACL::ParseAclLine(ae
);
766 dump_acl_list(StoreEntry
* entry
, acl_list
* head
)
770 for (l
= head
; l
; l
= l
->next
) {
771 storeAppendPrintf(entry
, " %s%s",
772 l
->op
? null_string
: "!",
778 dump_acl_access(StoreEntry
* entry
, const char *name
, acl_access
* head
)
782 for (l
= head
; l
; l
= l
->next
) {
783 storeAppendPrintf(entry
, "%s %s",
785 l
->allow
? "Allow" : "Deny");
786 dump_acl_list(entry
, l
->aclList
);
787 storeAppendPrintf(entry
, "\n");
792 parse_acl_access(acl_access
** head
)
794 aclParseAccessLine(head
);
798 free_acl_access(acl_access
** head
)
800 aclDestroyAccessList(head
);
805 dump_address(StoreEntry
* entry
, const char *name
, struct in_addr addr
)
807 storeAppendPrintf(entry
, "%s %s\n", name
, inet_ntoa(addr
));
812 parse_address(struct in_addr
*addr
)
815 const struct hostent
*hp
;
816 char *token
= strtok(NULL
, w_space
);
821 if (safe_inet_addr(token
, addr
) == 1)
823 else if ((hp
= gethostbyname(token
))) /* dont use ipcache */
824 *addr
= inaddrFromHostent(hp
);
831 free_address(struct in_addr
*addr
)
834 memset(addr
, '\0', sizeof(struct in_addr
));
837 CBDATA_TYPE(acl_address
);
840 dump_acl_address(StoreEntry
* entry
, const char *name
, acl_address
* head
)
844 for (l
= head
; l
; l
= l
->next
) {
845 if (l
->addr
.s_addr
!= INADDR_ANY
)
846 storeAppendPrintf(entry
, "%s %s", name
, inet_ntoa(l
->addr
));
848 storeAppendPrintf(entry
, "%s autoselect", name
);
850 dump_acl_list(entry
, l
->aclList
);
852 storeAppendPrintf(entry
, "\n");
857 freed_acl_address(void *data
)
859 acl_address
*l
= static_cast<acl_address
*>(data
);
860 aclDestroyAclList(&l
->aclList
);
864 parse_acl_address(acl_address
** head
)
867 acl_address
**tail
= head
; /* sane name below */
868 CBDATA_INIT_TYPE_FREECB(acl_address
, freed_acl_address
);
869 l
= cbdataAlloc(acl_address
);
870 parse_address(&l
->addr
);
871 aclParseAclList(&l
->aclList
);
874 tail
= &(*tail
)->next
;
880 free_acl_address(acl_address
** head
)
883 acl_address
*l
= *head
;
889 CBDATA_TYPE(acl_tos
);
892 dump_acl_tos(StoreEntry
* entry
, const char *name
, acl_tos
* head
)
896 for (l
= head
; l
; l
= l
->next
) {
898 storeAppendPrintf(entry
, "%s 0x%02X", name
, l
->tos
);
900 storeAppendPrintf(entry
, "%s none", name
);
902 dump_acl_list(entry
, l
->aclList
);
904 storeAppendPrintf(entry
, "\n");
909 freed_acl_tos(void *data
)
911 acl_tos
*l
= static_cast<acl_tos
*>(data
);
912 aclDestroyAclList(&l
->aclList
);
916 parse_acl_tos(acl_tos
** head
)
919 acl_tos
**tail
= head
; /* sane name below */
922 char *token
= strtok(NULL
, w_space
);
927 if (sscanf(token
, "0x%x%c", &tos
, &junk
) != 1)
930 if (tos
< 0 || tos
> 255)
933 CBDATA_INIT_TYPE_FREECB(acl_tos
, freed_acl_tos
);
935 l
= cbdataAlloc(acl_tos
);
939 aclParseAclList(&l
->aclList
);
942 tail
= &(*tail
)->next
;
948 free_acl_tos(acl_tos
** head
)
958 CBDATA_TYPE(acl_size_t
);
961 dump_acl_b_size_t(StoreEntry
* entry
, const char *name
, acl_size_t
* head
)
965 for (l
= head
; l
; l
= l
->next
) {
966 if (l
->size
!= static_cast<size_t>(-1))
967 storeAppendPrintf(entry
, "%s %d %s\n", name
, (int) l
->size
, B_BYTES_STR
);
969 storeAppendPrintf(entry
, "%s none", name
);
971 dump_acl_list(entry
, l
->aclList
);
973 storeAppendPrintf(entry
, "\n");
978 freed_acl_b_size_t(void *data
)
980 acl_size_t
*l
= static_cast<acl_size_t
*>(data
);
981 aclDestroyAclList(&l
->aclList
);
985 parse_acl_b_size_t(acl_size_t
** head
)
988 acl_size_t
**tail
= head
; /* sane name below */
990 CBDATA_INIT_TYPE_FREECB(acl_size_t
, freed_acl_b_size_t
);
992 l
= cbdataAlloc(acl_size_t
);
994 parse_b_size_t(&l
->size
);
996 aclParseAclList(&l
->aclList
);
999 tail
= &(*tail
)->next
;
1005 free_acl_b_size_t(acl_size_t
** head
)
1008 acl_size_t
*l
= *head
;
1017 #include "DelayPools.h"
1018 #include "DelayConfig.h"
1019 /* do nothing - free_delay_pool_count is the magic free function.
1020 * this is why delay_pool_count isn't just marked TYPE: ushort
1022 #define free_delay_pool_class(X)
1023 #define free_delay_pool_access(X)
1024 #define free_delay_pool_rates(X)
1025 #define dump_delay_pool_class(X, Y, Z)
1026 #define dump_delay_pool_access(X, Y, Z)
1027 #define dump_delay_pool_rates(X, Y, Z)
1030 free_delay_pool_count(DelayConfig
* cfg
)
1032 cfg
->freePoolCount();
1036 dump_delay_pool_count(StoreEntry
* entry
, const char *name
, DelayConfig
&cfg
)
1038 cfg
.dumpPoolCount (entry
, name
);
1042 parse_delay_pool_count(DelayConfig
* cfg
)
1044 cfg
->parsePoolCount();
1048 parse_delay_pool_class(DelayConfig
* cfg
)
1050 cfg
->parsePoolClass();
1054 parse_delay_pool_rates(DelayConfig
* cfg
)
1056 cfg
->parsePoolRates();
1060 parse_delay_pool_access(DelayConfig
* cfg
)
1062 cfg
->parsePoolAccess();
1069 dump_http_header_access(StoreEntry
* entry
, const char *name
, header_mangler header
[])
1073 for (i
= 0; i
< HDR_ENUM_END
; i
++) {
1074 if (header
[i
].access_list
!= NULL
) {
1075 storeAppendPrintf(entry
, "%s ", name
);
1076 dump_acl_access(entry
, httpHeaderNameById(i
),
1077 header
[i
].access_list
);
1083 parse_http_header_access(header_mangler header
[])
1088 if ((t
= strtok(NULL
, w_space
)) == NULL
) {
1089 debug(3, 0) ("%s line %d: %s\n",
1090 cfg_filename
, config_lineno
, config_input_line
);
1091 debug(3, 0) ("parse_http_header_access: missing header name.\n");
1095 /* Now lookup index of header. */
1096 id
= httpHeaderIdByNameDef(t
, strlen(t
));
1098 if (strcmp(t
, "All") == 0)
1100 else if (strcmp(t
, "Other") == 0)
1102 else if (id
== -1) {
1103 debug(3, 0) ("%s line %d: %s\n",
1104 cfg_filename
, config_lineno
, config_input_line
);
1105 debug(3, 0) ("parse_http_header_access: unknown header name %s.\n", t
);
1109 if (id
!= HDR_ENUM_END
) {
1110 parse_acl_access(&header
[id
].access_list
);
1112 char *next_string
= t
+ strlen(t
) - 1;
1114 *(next_string
+ 1) = ' ';
1116 for (i
= 0; i
< HDR_ENUM_END
; i
++) {
1117 char *new_string
= xstrdup(next_string
);
1118 strtok(new_string
, w_space
);
1119 parse_acl_access(&header
[i
].access_list
);
1120 safe_free(new_string
);
1126 free_http_header_access(header_mangler header
[])
1130 for (i
= 0; i
< HDR_ENUM_END
; i
++) {
1131 free_acl_access(&header
[i
].access_list
);
1136 dump_http_header_replace(StoreEntry
* entry
, const char *name
, header_mangler
1141 for (i
= 0; i
< HDR_ENUM_END
; i
++) {
1142 if (NULL
== header
[i
].replacement
)
1145 storeAppendPrintf(entry
, "%s %s %s\n", name
, httpHeaderNameById(i
),
1146 header
[i
].replacement
);
1151 parse_http_header_replace(header_mangler header
[])
1156 if ((t
= strtok(NULL
, w_space
)) == NULL
) {
1157 debug(3, 0) ("%s line %d: %s\n",
1158 cfg_filename
, config_lineno
, config_input_line
);
1159 debug(3, 0) ("parse_http_header_replace: missing header name.\n");
1163 /* Now lookup index of header. */
1164 id
= httpHeaderIdByNameDef(t
, strlen(t
));
1166 if (strcmp(t
, "All") == 0)
1168 else if (strcmp(t
, "Other") == 0)
1170 else if (id
== -1) {
1171 debug(3, 0) ("%s line %d: %s\n",
1172 cfg_filename
, config_lineno
, config_input_line
);
1173 debug(3, 0) ("parse_http_header_replace: unknown header name %s.\n",
1178 if (id
!= HDR_ENUM_END
) {
1179 if (header
[id
].replacement
!= NULL
)
1180 safe_free(header
[id
].replacement
);
1182 header
[id
].replacement
= xstrdup(t
+ strlen(t
) + 1);
1184 for (i
= 0; i
< HDR_ENUM_END
; i
++) {
1185 if (header
[i
].replacement
!= NULL
)
1186 safe_free(header
[i
].replacement
);
1188 header
[i
].replacement
= xstrdup(t
+ strlen(t
) + 1);
1194 free_http_header_replace(header_mangler header
[])
1198 for (i
= 0; i
< HDR_ENUM_END
; i
++) {
1199 if (header
[i
].replacement
!= NULL
)
1200 safe_free(header
[i
].replacement
);
1208 dump_cachedir(StoreEntry
* entry
, const char *name
, _SquidConfig::_cacheSwap swap
)
1214 for (i
= 0; i
< swap
.n_configured
; i
++) {
1215 s
= swap
.swapDirs
[i
];
1216 storeAppendPrintf(entry
, "%s %s %s", name
, s
->type(), s
->path
);
1218 storeAppendPrintf(entry
, "\n");
1224 check_null_cachedir(_SquidConfig::_cacheSwap swap
)
1226 return swap
.swapDirs
== NULL
;
1230 check_null_string(char *s
)
1236 parse_authparam(authConfig
* config
)
1241 if ((type_str
= strtok(NULL
, w_space
)) == NULL
)
1244 if ((param_str
= strtok(NULL
, w_space
)) == NULL
)
1247 /* find a configuration for the scheme */
1248 AuthConfig
*scheme
= AuthConfig::Find (type_str
);
1250 if (scheme
== NULL
) {
1251 /* Create a configuration */
1252 AuthScheme
*theScheme
;
1254 if ((theScheme
= AuthScheme::Find(type_str
)) == NULL
) {
1255 debug(3, 0) ("Parsing Config File: Unknown authentication scheme '%s'.\n", type_str
);
1259 config
->push_back(theScheme
->createConfig());
1260 scheme
= config
->back();
1264 scheme
->parse(scheme
, config
->size(), param_str
);
1268 free_authparam(authConfig
* cfg
)
1271 /* DON'T FREE THESE FOR RECONFIGURE */
1276 while (cfg
->size()) {
1277 scheme
= cfg
->pop_back();
1283 dump_authparam(StoreEntry
* entry
, const char *name
, authConfig cfg
)
1285 for (authConfig::iterator i
= cfg
.begin(); i
!= cfg
.end(); ++i
)
1286 (*i
)->dump(entry
, name
, (*i
));
1290 allocate_new_swapdir(_SquidConfig::_cacheSwap
* swap
)
1292 if (swap
->swapDirs
== NULL
) {
1293 swap
->n_allocated
= 4;
1294 swap
->swapDirs
= static_cast<SwapDir
**>(xcalloc(swap
->n_allocated
, sizeof(SwapDir
*)));
1297 if (swap
->n_allocated
== swap
->n_configured
) {
1299 swap
->n_allocated
<<= 1;
1300 tmp
= static_cast<SwapDir
**>(xcalloc(swap
->n_allocated
, sizeof(SwapDir
*)));
1301 xmemcpy(tmp
, swap
->swapDirs
, swap
->n_configured
* sizeof(SwapDir
*));
1302 xfree(swap
->swapDirs
);
1303 swap
->swapDirs
= tmp
;
1307 /* TODO: just return the object, the # is irrelevant */
1309 find_fstype(char *type
)
1311 for (size_t i
= 0; i
< StoreFileSystem::FileSystems().size(); ++i
)
1312 if (strcasecmp(type
, StoreFileSystem::FileSystems().items
[i
]->type()) == 0)
1319 parse_cachedir(_SquidConfig::_cacheSwap
* swap
)
1327 if ((type_str
= strtok(NULL
, w_space
)) == NULL
)
1330 if ((path_str
= strtok(NULL
, w_space
)) == NULL
)
1334 * This bit of code is a little strange.
1335 * See, if we find a path and type match for a given line, then
1336 * as long as we're reconfiguring, we can just call its reconfigure
1337 * function. No harm there.
1339 * Trouble is, if we find a path match, but not a type match, we have
1340 * a dilemma - we could gracefully shut down the fs, kill it, and
1341 * create a new one of a new type in its place, BUT at this stage the
1342 * fs is meant to be the *NEW* one, and so things go very strange. :-)
1344 * So, we'll assume the person isn't going to change the fs type for now,
1345 * and XXX later on we will make sure that its picked up.
1347 * (moving around cache_dir lines will be looked at later in a little
1348 * more sane detail..)
1351 for (i
= 0; i
< swap
->n_configured
; i
++) {
1352 assert (swap
->swapDirs
[i
]);
1354 if (0 == strcasecmp(path_str
, swap
->swapDirs
[i
]->path
)) {
1355 /* This is a little weird, you'll appreciate it later */
1356 fs
= find_fstype(type_str
);
1359 fatalf("Unknown cache_dir type '%s'\n", type_str
);
1362 sd
= swap
->swapDirs
[i
];
1363 sd
->reconfigure (i
, path_str
);
1364 update_maxobjsize();
1369 assert(swap
->n_configured
< 63); /* 7 bits, signed */
1371 fs
= find_fstype(type_str
);
1374 /* If we get here, we didn't find a matching cache_dir type */
1375 fatalf("Unknown cache_dir type '%s'\n", type_str
);
1378 allocate_new_swapdir(swap
);
1379 swap
->swapDirs
[swap
->n_configured
] = StoreFileSystem::FileSystems().items
[fs
]->createSwapDir();
1380 sd
= swap
->swapDirs
[swap
->n_configured
];
1381 /* parse the FS parameters and options */
1382 sd
->parse(swap
->n_configured
, path_str
);
1383 ++swap
->n_configured
;
1384 /* Update the max object size */
1385 update_maxobjsize();
1389 free_cachedir(_SquidConfig::_cacheSwap
* swap
)
1392 /* DON'T FREE THESE FOR RECONFIGURE */
1397 for (i
= 0; i
< swap
->n_configured
; i
++) {
1398 SwapDir
* s
= swap
->swapDirs
[i
];
1399 swap
->swapDirs
[i
] = NULL
;
1403 safe_free(swap
->swapDirs
);
1404 swap
->swapDirs
= NULL
;
1405 swap
->n_allocated
= 0;
1406 swap
->n_configured
= 0;
1410 peer_type_str(const peer_t type
)
1422 case PEER_MULTICAST
:
1433 dump_peer(StoreEntry
* entry
, const char *name
, peer
* p
)
1437 LOCAL_ARRAY(char, xname
, 128);
1440 storeAppendPrintf(entry
, "%s %s %s %d %d",
1446 dump_peer_options(entry
, p
);
1448 for (d
= p
->peer_domain
; d
; d
= d
->next
) {
1449 storeAppendPrintf(entry
, "cache_peer_domain %s %s%s\n",
1451 d
->do_ping
? null_string
: "!",
1456 snprintf(xname
, 128, "cache_peer_access %s", p
->name
);
1457 dump_acl_access(entry
, xname
, p
->access
);
1460 for (t
= p
->typelist
; t
; t
= t
->next
) {
1461 storeAppendPrintf(entry
, "neighbor_type_domain %s %s %s\n",
1463 peer_type_str(t
->type
),
1472 parse_peer(peer
** head
)
1477 CBDATA_INIT_TYPE_FREECB(peer
, peerDestroy
);
1478 p
= cbdataAlloc(peer
);
1479 p
->http_port
= CACHE_HTTP_PORT
;
1480 p
->icp
.port
= CACHE_ICP_PORT
;
1483 p
->stats
.logged_state
= PEER_ALIVE
;
1485 if ((token
= strtok(NULL
, w_space
)) == NULL
)
1488 p
->host
= xstrdup(token
);
1490 p
->name
= xstrdup(token
);
1492 if ((token
= strtok(NULL
, w_space
)) == NULL
)
1495 p
->type
= parseNeighborType(token
);
1499 p
->http_port
= (u_short
) i
;
1503 p
->icp
.port
= (u_short
) i
;
1505 while ((token
= strtok(NULL
, w_space
))) {
1506 if (!strcasecmp(token
, "proxy-only")) {
1507 p
->options
.proxy_only
= 1;
1508 } else if (!strcasecmp(token
, "no-query")) {
1509 p
->options
.no_query
= 1;
1510 } else if (!strcasecmp(token
, "background-ping")) {
1511 p
->options
.background_ping
= 1;
1512 } else if (!strcasecmp(token
, "no-digest")) {
1513 p
->options
.no_digest
= 1;
1514 } else if (!strcasecmp(token
, "multicast-responder")) {
1515 p
->options
.mcast_responder
= 1;
1516 } else if (!strncasecmp(token
, "weight=", 7)) {
1517 p
->weight
= xatoi(token
+ 7);
1518 } else if (!strncasecmp(token
, "basetime=", 9)) {
1519 p
->basetime
= xatoi(token
+ 9);
1520 } else if (!strcasecmp(token
, "closest-only")) {
1521 p
->options
.closest_only
= 1;
1522 } else if (!strncasecmp(token
, "ttl=", 4)) {
1523 p
->mcast
.ttl
= xatoi(token
+ 4);
1525 if (p
->mcast
.ttl
< 0)
1528 if (p
->mcast
.ttl
> 128)
1530 } else if (!strcasecmp(token
, "default")) {
1531 p
->options
.default_parent
= 1;
1532 } else if (!strcasecmp(token
, "round-robin")) {
1533 p
->options
.roundrobin
= 1;
1534 } else if (!strcasecmp(token
, "weighted-round-robin")) {
1535 p
->options
.weighted_roundrobin
= 1;
1538 } else if (!strcasecmp(token
, "htcp")) {
1539 p
->options
.htcp
= 1;
1542 } else if (!strcasecmp(token
, "no-netdb-exchange")) {
1543 p
->options
.no_netdb_exchange
= 1;
1546 } else if (!strcasecmp(token
, "carp")) {
1547 if (p
->type
!= PEER_PARENT
)
1548 fatalf("parse_peer: non-parent carp peer %s/%d\n", p
->host
, p
->http_port
);
1550 p
->options
.carp
= 1;
1555 } else if (!strcasecmp(token
, "no-delay")) {
1556 p
->options
.no_delay
= 1;
1559 } else if (!strncasecmp(token
, "login=", 6)) {
1560 p
->login
= xstrdup(token
+ 6);
1561 rfc1738_unescape(p
->login
);
1562 } else if (!strncasecmp(token
, "connect-timeout=", 16)) {
1563 p
->connect_timeout
= xatoi(token
+ 16);
1564 #if USE_CACHE_DIGESTS
1566 } else if (!strncasecmp(token
, "digest-url=", 11)) {
1567 p
->digest_url
= xstrdup(token
+ 11);
1570 } else if (!strcasecmp(token
, "allow-miss")) {
1571 p
->options
.allow_miss
= 1;
1572 } else if (!strncasecmp(token
, "max-conn=", 9)) {
1573 p
->max_conn
= xatoi(token
+ 9);
1574 } else if (!strcasecmp(token
, "originserver")) {
1575 p
->options
.originserver
= 1;
1576 } else if (!strncasecmp(token
, "name=", 5)) {
1580 p
->name
= xstrdup(token
+ 5);
1581 } else if (!strncasecmp(token
, "forceddomain=", 13)) {
1582 safe_free(p
->domain
);
1585 p
->domain
= xstrdup(token
+ 13);
1589 } else if (strcmp(token
, "ssl") == 0) {
1591 } else if (strncmp(token
, "sslcert=", 8) == 0) {
1592 safe_free(p
->sslcert
);
1593 p
->sslcert
= xstrdup(token
+ 8);
1594 } else if (strncmp(token
, "sslkey=", 7) == 0) {
1595 safe_free(p
->sslkey
);
1596 p
->sslkey
= xstrdup(token
+ 7);
1597 } else if (strncmp(token
, "sslversion=", 11) == 0) {
1598 p
->sslversion
= atoi(token
+ 11);
1599 } else if (strncmp(token
, "ssloptions=", 11) == 0) {
1600 safe_free(p
->ssloptions
);
1601 p
->ssloptions
= xstrdup(token
+ 11);
1602 } else if (strncmp(token
, "sslcipher=", 10) == 0) {
1603 safe_free(p
->sslcipher
);
1604 p
->sslcipher
= xstrdup(token
+ 10);
1605 } else if (strncmp(token
, "sslcafile=", 10) == 0) {
1606 safe_free(p
->sslcafile
);
1607 p
->sslcipher
= xstrdup(token
+ 10);
1608 } else if (strncmp(token
, "sslcapath=", 10) == 0) {
1609 safe_free(p
->sslcapath
);
1610 p
->sslcipher
= xstrdup(token
+ 10);
1611 } else if (strncmp(token
, "sslflags=", 9) == 0) {
1612 safe_free(p
->sslflags
);
1613 p
->sslflags
= xstrdup(token
+ 9);
1614 } else if (strncmp(token
, "ssldomain=", 10) == 0) {
1615 safe_free(p
->ssldomain
);
1616 p
->ssldomain
= xstrdup(token
+ 10);
1619 } else if (strcmp(token
, "front-end-https") == 0) {
1620 p
->front_end_https
= 1;
1621 } else if (strcmp(token
, "front-end-https=on") == 0) {
1622 p
->front_end_https
= 1;
1623 } else if (strcmp(token
, "front-end-https=auto") == 0) {
1624 p
->front_end_https
= 2;
1626 debug(3, 0) ("parse_peer: token='%s'\n", token
);
1631 if (peerFindByName(p
->name
))
1632 fatalf("ERROR: cache_peer %s specified twice\n", p
->name
);
1637 p
->icp
.version
= ICP_VERSION_CURRENT
;
1639 p
->tcp_up
= PEER_TCP_MAGIC_COUNT
;
1643 #if USE_CACHE_DIGESTS
1645 if (!p
->options
.no_digest
) {
1646 /* XXX This looks odd.. who has the original pointer
1649 PeerDigest
*pd
= peerDigestCreate(p
);
1650 p
->digest
= cbdataReference(pd
);
1656 p
->sslContext
= sslCreateClientContext(p
->sslcert
, p
->sslkey
, p
->sslversion
, p
->sslcipher
, p
->ssloptions
, p
->sslflags
, p
->sslcafile
, p
->sslcapath
);
1660 while (*head
!= NULL
)
1661 head
= &(*head
)->next
;
1671 free_peer(peer
** P
)
1675 while ((p
= *P
) != NULL
) {
1677 #if USE_CACHE_DIGESTS
1679 cbdataReferenceDone(p
->digest
);
1689 dump_cachemgrpasswd(StoreEntry
* entry
, const char *name
, cachemgr_passwd
* list
)
1693 while (list
!= NULL
) {
1694 if (strcmp(list
->passwd
, "none") && strcmp(list
->passwd
, "disable"))
1695 storeAppendPrintf(entry
, "%s XXXXXXXXXX", name
);
1697 storeAppendPrintf(entry
, "%s %s", name
, list
->passwd
);
1699 for (w
= list
->actions
; w
!= NULL
; w
= w
->next
) {
1700 storeAppendPrintf(entry
, " %s", w
->key
);
1703 storeAppendPrintf(entry
, "\n");
1709 parse_cachemgrpasswd(cachemgr_passwd
** head
)
1711 char *passwd
= NULL
;
1712 wordlist
*actions
= NULL
;
1714 cachemgr_passwd
**P
;
1715 parse_string(&passwd
);
1716 parse_wordlist(&actions
);
1717 p
= static_cast<cachemgr_passwd
*>(xcalloc(1, sizeof(cachemgr_passwd
)));
1719 p
->actions
= actions
;
1721 for (P
= head
; *P
; P
= &(*P
)->next
) {
1723 * See if any of the actions from this line already have a
1724 * password from previous lines. The password checking
1725 * routines in cache_manager.c take the the password from
1726 * the first cachemgr_passwd struct that contains the
1727 * requested action. Thus, we should warn users who might
1728 * think they can have two passwords for the same action.
1733 for (w
= (*P
)->actions
; w
; w
= w
->next
) {
1734 for (u
= actions
; u
; u
= u
->next
) {
1735 if (strcmp(w
->key
, u
->key
))
1738 debug(0, 0) ("WARNING: action '%s' (line %d) already has a password\n",
1739 u
->key
, config_lineno
);
1748 free_cachemgrpasswd(cachemgr_passwd
** head
)
1752 while ((p
= *head
) != NULL
) {
1755 wordlistDestroy(&p
->actions
);
1761 dump_denyinfo(StoreEntry
* entry
, const char *name
, acl_deny_info_list
* var
)
1765 while (var
!= NULL
) {
1766 storeAppendPrintf(entry
, "%s %s", name
, var
->err_page_name
);
1768 for (a
= var
->acl_list
; a
!= NULL
; a
= a
->next
)
1769 storeAppendPrintf(entry
, " %s", a
->name
);
1771 storeAppendPrintf(entry
, "\n");
1778 parse_denyinfo(acl_deny_info_list
** var
)
1780 aclParseDenyInfoLine(var
);
1784 free_denyinfo(acl_deny_info_list
** list
)
1786 acl_deny_info_list
*a
= NULL
;
1787 acl_deny_info_list
*a_next
= NULL
;
1788 acl_name_list
*l
= NULL
;
1789 acl_name_list
*l_next
= NULL
;
1791 for (a
= *list
; a
; a
= a_next
) {
1792 for (l
= a
->acl_list
; l
; l
= l_next
) {
1794 memFree(l
, MEM_ACL_NAME_LIST
);
1799 memFree(a
, MEM_ACL_DENY_INFO_LIST
);
1807 parse_peer_access(void)
1812 if (!(host
= strtok(NULL
, w_space
)))
1815 if ((p
= peerFindByName(host
)) == NULL
) {
1816 debug(15, 0) ("%s, line %d: No cache_peer '%s'\n",
1817 cfg_filename
, config_lineno
, host
);
1821 aclParseAccessLine(&p
->access
);
1825 parse_hostdomain(void)
1828 char *domain
= NULL
;
1830 if (!(host
= strtok(NULL
, w_space
)))
1833 while ((domain
= strtok(NULL
, list_sep
))) {
1834 domain_ping
*l
= NULL
;
1835 domain_ping
**L
= NULL
;
1838 if ((p
= peerFindByName(host
)) == NULL
) {
1839 debug(15, 0) ("%s, line %d: No cache_peer '%s'\n",
1840 cfg_filename
, config_lineno
, host
);
1844 l
= static_cast<domain_ping
*>(xcalloc(1, sizeof(domain_ping
)));
1847 if (*domain
== '!') { /* check for !.edu */
1852 l
->domain
= xstrdup(domain
);
1854 for (L
= &(p
->peer_domain
); *L
; L
= &((*L
)->next
))
1862 parse_hostdomaintype(void)
1866 char *domain
= NULL
;
1868 if (!(host
= strtok(NULL
, w_space
)))
1871 if (!(type
= strtok(NULL
, w_space
)))
1874 while ((domain
= strtok(NULL
, list_sep
))) {
1875 domain_type
*l
= NULL
;
1876 domain_type
**L
= NULL
;
1879 if ((p
= peerFindByName(host
)) == NULL
) {
1880 debug(15, 0) ("%s, line %d: No cache_peer '%s'\n",
1881 cfg_filename
, config_lineno
, host
);
1885 l
= static_cast<domain_type
*>(xcalloc(1, sizeof(domain_type
)));
1886 l
->type
= parseNeighborType(type
);
1887 l
->domain
= xstrdup(domain
);
1889 for (L
= &(p
->typelist
); *L
; L
= &((*L
)->next
))
1898 dump_ushortlist(StoreEntry
* entry
, const char *name
, ushortlist
* u
)
1901 storeAppendPrintf(entry
, "%s %d\n", name
, (int) u
->i
);
1907 check_null_ushortlist(ushortlist
* u
)
1913 parse_ushortlist(ushortlist
** P
)
1920 while ((token
= strtok(NULL
, w_space
))) {
1921 if (sscanf(token
, "%d", &i
) != 1)
1927 u
= xcalloc(1, sizeof(ushortlist
));
1931 for (U
= P
; *U
; U
= &(*U
)->next
)
1939 free_ushortlist(ushortlist
** P
)
1943 while ((u
= *P
) != NULL
) {
1952 dump_int(StoreEntry
* entry
, const char *name
, int var
)
1954 storeAppendPrintf(entry
, "%s %d\n", name
, var
);
1972 dump_onoff(StoreEntry
* entry
, const char *name
, int var
)
1974 storeAppendPrintf(entry
, "%s %s\n", name
, var
? "on" : "off");
1978 parse_onoff(int *var
)
1980 char *token
= strtok(NULL
, w_space
);
1985 if (!strcasecmp(token
, "on") || !strcasecmp(token
, "enable"))
1991 #define free_onoff free_int
1992 #define dump_eol dump_string
1993 #define free_eol free_string
1994 #define dump_debug dump_string
1995 #define free_debug free_string
1998 dump_refreshpattern(StoreEntry
* entry
, const char *name
, refresh_t
* head
)
2000 while (head
!= NULL
) {
2001 storeAppendPrintf(entry
, "%s%s %s %d %d%% %d\n",
2003 head
->flags
.icase
? " -i" : null_string
,
2005 (int) head
->min
/ 60,
2006 (int) (100.0 * head
->pct
+ 0.5),
2007 (int) head
->max
/ 60);
2010 if (head
->flags
.override_expire
)
2011 storeAppendPrintf(entry
, " override-expire");
2013 if (head
->flags
.override_lastmod
)
2014 storeAppendPrintf(entry
, " override-lastmod");
2016 if (head
->flags
.reload_into_ims
)
2017 storeAppendPrintf(entry
, " reload-into-ims");
2019 if (head
->flags
.ignore_reload
)
2020 storeAppendPrintf(entry
, " ignore-reload");
2024 storeAppendPrintf(entry
, "\n");
2031 parse_refreshpattern(refresh_t
** head
)
2040 int override_expire
= 0;
2041 int override_lastmod
= 0;
2042 int reload_into_ims
= 0;
2043 int ignore_reload
= 0;
2050 int flags
= REG_EXTENDED
| REG_NOSUB
;
2052 if ((token
= strtok(NULL
, w_space
)) == NULL
)
2055 if (strcmp(token
, "-i") == 0) {
2057 token
= strtok(NULL
, w_space
);
2058 } else if (strcmp(token
, "+i") == 0) {
2059 flags
&= ~REG_ICASE
;
2060 token
= strtok(NULL
, w_space
);
2066 pattern
= xstrdup(token
);
2068 i
= GetInteger(); /* token: min */
2070 min
= (time_t) (i
* 60); /* convert minutes to seconds */
2072 i
= GetInteger(); /* token: pct */
2074 pct
= (double) i
/ 100.0;
2076 i
= GetInteger(); /* token: max */
2078 max
= (time_t) (i
* 60); /* convert minutes to seconds */
2081 while ((token
= strtok(NULL
, w_space
)) != NULL
) {
2084 if (!strcmp(token
, "override-expire"))
2085 override_expire
= 1;
2086 else if (!strcmp(token
, "override-lastmod"))
2087 override_lastmod
= 1;
2088 else if (!strcmp(token
, "reload-into-ims")) {
2089 reload_into_ims
= 1;
2090 refresh_nocache_hack
= 1;
2091 /* tell client_side.c that this is used */
2092 } else if (!strcmp(token
, "ignore-reload")) {
2094 refresh_nocache_hack
= 1;
2095 /* tell client_side.c that this is used */
2099 debug(22, 0) ("redreshAddToList: Unknown option '%s': %s\n",
2103 if ((errcode
= regcomp(&comp
, pattern
, flags
)) != 0) {
2105 regerror(errcode
, &comp
, errbuf
, sizeof errbuf
);
2106 debug(22, 0) ("%s line %d: %s\n",
2107 cfg_filename
, config_lineno
, config_input_line
);
2108 debug(22, 0) ("refreshAddToList: Invalid regular expression '%s': %s\n",
2113 pct
= pct
< 0.0 ? 0.0 : pct
;
2114 max
= max
< 0 ? 0 : max
;
2115 t
= static_cast<refresh_t
*>(xcalloc(1, sizeof(refresh_t
)));
2116 t
->pattern
= (char *) xstrdup(pattern
);
2117 t
->compiled_pattern
= comp
;
2122 if (flags
& REG_ICASE
)
2127 if (override_expire
)
2128 t
->flags
.override_expire
= 1;
2130 if (override_lastmod
)
2131 t
->flags
.override_lastmod
= 1;
2133 if (reload_into_ims
)
2134 t
->flags
.reload_into_ims
= 1;
2137 t
->flags
.ignore_reload
= 1;
2144 head
= &(*head
)->next
;
2153 check_null_refreshpattern(refresh_t
* data
)
2155 return data
== NULL
;
2161 free_refreshpattern(refresh_t
** head
)
2165 while ((t
= *head
) != NULL
) {
2167 safe_free(t
->pattern
);
2168 regfree(&t
->compiled_pattern
);
2174 dump_string(StoreEntry
* entry
, const char *name
, char *var
)
2177 storeAppendPrintf(entry
, "%s %s\n", name
, var
);
2181 parse_string(char **var
)
2183 char *token
= strtok(NULL
, w_space
);
2189 *var
= xstrdup(token
);
2193 free_string(char **var
)
2199 parse_eol(char *volatile *var
)
2201 unsigned char *token
= (unsigned char *) strtok(NULL
, null_string
);
2207 while (*token
&& isspace(*token
))
2213 *var
= xstrdup((char *) token
);
2217 parse_debug(char *volatile *var
)
2220 safe_free(debug_options
)
2221 debug_options
= xstrdup(Config
.debugOptions
);
2222 Debug::parseOptions(Config
.debugOptions
);
2226 dump_time_t(StoreEntry
* entry
, const char *name
, time_t var
)
2228 storeAppendPrintf(entry
, "%s %d seconds\n", name
, (int) var
);
2232 parse_time_t(time_t * var
)
2234 parseTimeLine(var
, T_SECOND_STR
);
2238 free_time_t(time_t * var
)
2244 dump_size_t(StoreEntry
* entry
, const char *name
, size_t var
)
2246 storeAppendPrintf(entry
, "%s %d\n", name
, (int) var
);
2250 dump_b_size_t(StoreEntry
* entry
, const char *name
, size_t var
)
2252 storeAppendPrintf(entry
, "%s %d %s\n", name
, (int) var
, B_BYTES_STR
);
2256 dump_kb_size_t(StoreEntry
* entry
, const char *name
, size_t var
)
2258 storeAppendPrintf(entry
, "%s %d %s\n", name
, (int) var
, B_KBYTES_STR
);
2262 parse_size_t(size_t * var
)
2270 parse_b_size_t(size_t * var
)
2272 parseBytesLine(var
, B_BYTES_STR
);
2276 parse_kb_size_t(size_t * var
)
2278 parseBytesLine(var
, B_KBYTES_STR
);
2282 free_size_t(size_t * var
)
2287 #define free_b_size_t free_size_t
2288 #define free_kb_size_t free_size_t
2289 #define free_mb_size_t free_size_t
2290 #define free_gb_size_t free_size_t
2293 dump_ushort(StoreEntry
* entry
, const char *name
, u_short var
)
2295 storeAppendPrintf(entry
, "%s %d\n", name
, var
);
2299 free_ushort(u_short
* u
)
2305 parse_ushort(u_short
* var
)
2307 ConfigParser::ParseUShort(var
);
2311 ConfigParser::ParseUShort(u_short
*var
)
2324 dump_wordlist(StoreEntry
* entry
, const char *name
, wordlist
* list
)
2326 while (list
!= NULL
) {
2327 storeAppendPrintf(entry
, "%s %s\n", name
, list
->key
);
2333 parse_wordlist(wordlist
** list
)
2336 char *t
= strtok(NULL
, "");
2338 while ((token
= strwordtok(NULL
, &t
)))
2339 wordlistAdd(list
, token
);
2343 check_null_wordlist(wordlist
* w
)
2349 check_null_acl_access(acl_access
* a
)
2354 #define free_wordlist wordlistDestroy
2356 #define free_uri_whitespace free_int
2359 parse_uri_whitespace(int *var
)
2361 char *token
= strtok(NULL
, w_space
);
2366 if (!strcasecmp(token
, "strip"))
2367 *var
= URI_WHITESPACE_STRIP
;
2368 else if (!strcasecmp(token
, "deny"))
2369 *var
= URI_WHITESPACE_DENY
;
2370 else if (!strcasecmp(token
, "allow"))
2371 *var
= URI_WHITESPACE_ALLOW
;
2372 else if (!strcasecmp(token
, "encode"))
2373 *var
= URI_WHITESPACE_ENCODE
;
2374 else if (!strcasecmp(token
, "chop"))
2375 *var
= URI_WHITESPACE_CHOP
;
2382 dump_uri_whitespace(StoreEntry
* entry
, const char *name
, int var
)
2386 if (var
== URI_WHITESPACE_ALLOW
)
2388 else if (var
== URI_WHITESPACE_ENCODE
)
2390 else if (var
== URI_WHITESPACE_CHOP
)
2392 else if (var
== URI_WHITESPACE_DENY
)
2397 storeAppendPrintf(entry
, "%s %s\n", name
, s
);
2401 free_removalpolicy(RemovalPolicySettings
** settings
)
2406 free_string(&(*settings
)->type
);
2408 free_wordlist(&(*settings
)->args
);
2416 parse_removalpolicy(RemovalPolicySettings
** settings
)
2419 free_removalpolicy(settings
);
2421 *settings
= static_cast<RemovalPolicySettings
*>(xcalloc(1, sizeof(**settings
)));
2423 parse_string(&(*settings
)->type
);
2425 parse_wordlist(&(*settings
)->args
);
2429 dump_removalpolicy(StoreEntry
* entry
, const char *name
, RemovalPolicySettings
* settings
)
2432 storeAppendPrintf(entry
, "%s %s", name
, settings
->type
);
2433 args
= settings
->args
;
2436 storeAppendPrintf(entry
, " %s", args
->key
);
2440 storeAppendPrintf(entry
, "\n");
2444 #include "cf_parser.h"
2447 parseNeighborType(const char *s
)
2449 if (!strcasecmp(s
, "parent"))
2452 if (!strcasecmp(s
, "neighbor"))
2453 return PEER_SIBLING
;
2455 if (!strcasecmp(s
, "neighbour"))
2456 return PEER_SIBLING
;
2458 if (!strcasecmp(s
, "sibling"))
2459 return PEER_SIBLING
;
2461 if (!strcasecmp(s
, "multicast"))
2462 return PEER_MULTICAST
;
2464 debug(15, 0) ("WARNING: Unknown neighbor type: %s\n", s
);
2466 return PEER_SIBLING
;
2469 #if CURRENTLY_UNUSED
2470 /* This code was previously used by http_port. Left as it really should
2471 * be used by icp_port and htcp_port
2474 parse_sockaddr_in_list_token(sockaddr_in_list
** head
, char *token
)
2479 const struct hostent
*hp
;
2480 unsigned short port
;
2481 sockaddr_in_list
*s
;
2486 if ((t
= strchr(token
, ':'))) {
2490 port
= (unsigned short) xatoi(t
+ 1);
2494 } else if ((port
= xatoi(token
)) > 0) {
2500 s
= static_cast<sockaddr_in_list
*>(xcalloc(1, sizeof(*s
)));
2501 s
->s
.sin_port
= htons(port
);
2504 s
->s
.sin_addr
= any_addr
;
2505 else if (1 == safe_inet_addr(host
, &s
->s
.sin_addr
))
2507 else if ((hp
= gethostbyname(host
))) /* dont use ipcache */
2508 s
->s
.sin_addr
= inaddrFromHostent(hp
);
2513 head
= &(*head
)->next
;
2519 parse_sockaddr_in_list(sockaddr_in_list
** head
)
2523 while ((token
= strtok(NULL
, w_space
))) {
2524 parse_sockaddr_in_list_token(head
, token
);
2529 dump_sockaddr_in_list(StoreEntry
* e
, const char *n
, const sockaddr_in_list
* s
)
2532 storeAppendPrintf(e
, "%s %s:%d\n",
2534 inet_ntoa(s
->s
.sin_addr
),
2535 ntohs(s
->s
.sin_port
));
2541 free_sockaddr_in_list(sockaddr_in_list
** head
)
2543 sockaddr_in_list
*s
;
2545 while ((s
= *head
) != NULL
) {
2552 check_null_sockaddr_in_list(const sockaddr_in_list
* s
)
2557 #endif /* CURRENTLY_UNUSED */
2560 parse_http_port_specification(http_port_list
* s
, char *token
)
2564 const struct hostent
*hp
;
2565 unsigned short port
= 0;
2568 if ((t
= strchr(token
, ':'))) {
2572 port
= (unsigned short) atoi(t
+ 1);
2576 } else if ((port
= atoi(token
)) > 0) {
2582 s
->s
.sin_port
= htons(port
);
2585 s
->s
.sin_addr
= any_addr
;
2586 else if (1 == safe_inet_addr(host
, &s
->s
.sin_addr
))
2588 else if ((hp
= gethostbyname(host
))) {
2589 /* dont use ipcache */
2590 s
->s
.sin_addr
= inaddrFromHostent(hp
);
2591 s
->defaultsite
= xstrdup(host
);
2597 parse_http_port_option(http_port_list
* s
, char *token
)
2599 if (strncmp(token
, "defaultsite=", 12) == 0) {
2600 safe_free(s
->defaultsite
);
2601 s
->defaultsite
= xstrdup(token
+ 12);
2603 } else if (strncmp(token
, "name=", 5) == 0) {
2605 s
->name
= xstrdup(token
+ 5);
2606 } else if (strcmp(token
, "transparent") == 0) {
2608 } else if (strcmp(token
, "vhost") == 0) {
2611 } else if (strcmp(token
, "vport") == 0) {
2614 } else if (strncmp(token
, "vport=", 6) == 0) {
2615 s
->vport
= atoi(token
+ 6);
2617 } else if (strncmp(token
, "protocol=", 9) == 0) {
2618 s
->protocol
= xstrdup(token
+ 9);
2620 } else if (strcmp(token
, "accel") == 0) {
2628 free_generic_http_port_data(http_port_list
* s
)
2631 safe_free(s
->defaultsite
);
2635 cbdataFree_http_port(void *data
)
2637 free_generic_http_port_data((http_port_list
*)data
);
2641 static http_port_list
*
2642 create_http_port(char *portspec
)
2644 CBDATA_TYPE(http_port_list
);
2645 CBDATA_INIT_TYPE_FREECB(http_port_list
, cbdataFree_http_port
);
2647 http_port_list
*s
= cbdataAlloc(http_port_list
);
2648 s
->protocol
= xstrdup("http");
2649 parse_http_port_specification(s
, portspec
);
2654 add_http_port(char *portspec
)
2656 http_port_list
*s
= create_http_port(portspec
);
2657 s
->next
= Config
.Sockaddr
.http
;
2658 Config
.Sockaddr
.http
= s
;
2662 parse_http_port_list(http_port_list
** head
)
2664 char *token
= strtok(NULL
, w_space
);
2669 http_port_list
*s
= create_http_port(token
);
2671 /* parse options ... */
2672 while ((token
= strtok(NULL
, w_space
))) {
2673 parse_http_port_option(s
, token
);
2677 head
= &(*head
)->next
;
2683 dump_generic_http_port(StoreEntry
* e
, const char *n
, const http_port_list
* s
)
2685 storeAppendPrintf(e
, "%s %s:%d",
2687 inet_ntoa(s
->s
.sin_addr
),
2688 ntohs(s
->s
.sin_port
));
2691 storeAppendPrintf(e
, " defaultsite=%s", s
->defaultsite
);
2694 storeAppendPrintf(e
, " transparent");
2697 storeAppendPrintf(e
, " vhost");
2700 storeAppendPrintf(e
, " vport");
2704 dump_http_port_list(StoreEntry
* e
, const char *n
, const http_port_list
* s
)
2707 dump_generic_http_port(e
, n
, s
);
2708 storeAppendPrintf(e
, "\n");
2714 free_http_port_list(http_port_list
** head
)
2718 while ((s
= *head
) != NULL
) {
2726 check_null_http_port_list(const http_port_list
* s
)
2735 cbdataFree_https_port(void *data
)
2737 https_port_list
*s
= (https_port_list
*)data
;
2738 free_generic_http_port_data(&s
->http
);
2744 parse_https_port_list(https_port_list
** head
)
2746 CBDATA_TYPE(https_port_list
);
2749 CBDATA_INIT_TYPE_FREECB(https_port_list
, cbdataFree_https_port
);
2750 token
= strtok(NULL
, w_space
);
2755 s
= cbdataAlloc(https_port_list
);
2757 s
->http
.protocol
= xstrdup("https");
2759 parse_http_port_specification(&s
->http
, token
);
2761 /* parse options ... */
2762 while ((token
= strtok(NULL
, w_space
))) {
2763 if (strncmp(token
, "cert=", 5) == 0) {
2765 s
->cert
= xstrdup(token
+ 5);
2766 } else if (strncmp(token
, "key=", 4) == 0) {
2768 s
->key
= xstrdup(token
+ 4);
2769 } else if (strncmp(token
, "version=", 8) == 0) {
2770 s
->version
= xatoi(token
+ 8);
2771 } else if (strncmp(token
, "options=", 8) == 0) {
2772 safe_free(s
->options
);
2773 s
->options
= xstrdup(token
+ 8);
2774 } else if (strncmp(token
, "cipher=", 7) == 0) {
2775 safe_free(s
->cipher
);
2776 s
->cipher
= xstrdup(token
+ 7);
2777 } else if (strncmp(token
, "clientca=", 9) == 0) {
2778 safe_free(s
->clientca
);
2779 s
->clientca
= xstrdup(token
+ 9);
2780 } else if (strncmp(token
, "cafile=", 7) == 0) {
2781 safe_free(s
->cafile
);
2782 s
->cafile
= xstrdup(token
+ 7);
2783 } else if (strncmp(token
, "capath=", 7) == 0) {
2784 safe_free(s
->capath
);
2785 s
->capath
= xstrdup(token
+ 7);
2786 } else if (strncmp(token
, "dhparams=", 9) == 0) {
2787 safe_free(s
->dhfile
);
2788 s
->dhfile
= xstrdup(token
+ 9);
2789 } else if (strncmp(token
, "sslflags=", 9) == 0) {
2790 safe_free(s
->sslflags
);
2791 s
->sslflags
= xstrdup(token
+ 9);
2793 parse_http_port_option(&s
->http
, token
);
2797 s
->sslContext
= sslCreateServerContext(s
->cert
, s
->key
, s
->version
, s
->cipher
, s
->options
, s
->sslflags
, s
->clientca
, s
->cafile
, s
->capath
, s
->dhfile
);
2803 head
= (https_port_list
**)&(*head
)->http
.next
;
2809 dump_https_port_list(StoreEntry
* e
, const char *n
, const https_port_list
* s
)
2812 dump_generic_http_port(e
, n
, &s
->http
);
2815 storeAppendPrintf(e
, " cert=%s", s
->cert
);
2818 storeAppendPrintf(e
, " key=%s", s
->cert
);
2821 storeAppendPrintf(e
, " version=%d", s
->version
);
2824 storeAppendPrintf(e
, " options=%s", s
->options
);
2827 storeAppendPrintf(e
, " cipher=%s", s
->cipher
);
2830 storeAppendPrintf(e
, " cafile=%s", s
->cafile
);
2833 storeAppendPrintf(e
, " capath=%s", s
->capath
);
2836 storeAppendPrintf(e
, " dhparams=%s", s
->dhfile
);
2839 storeAppendPrintf(e
, " sslflags=%s", s
->sslflags
);
2841 storeAppendPrintf(e
, "\n");
2843 s
= (https_port_list
*) s
->http
.next
;
2848 free_https_port_list(https_port_list
** head
)
2852 while ((s
= *head
) != NULL
) {
2853 *head
= (https_port_list
*) s
->http
.next
;
2860 check_null_https_port_list(const https_port_list
* s
)
2867 #endif /* USE_SSL */
2870 configFreeMemory(void)
2876 requirePathnameExists(const char *name
, const char *path
)
2880 char pathbuf
[BUFSIZ
];
2881 assert(path
!= NULL
);
2883 if (Config
.chroot_dir
) {
2884 snprintf(pathbuf
, BUFSIZ
, "%s/%s", Config
.chroot_dir
, path
);
2888 if (stat(path
, &sb
) < 0)
2889 fatalf("%s %s: %s", name
, path
, xstrerror());
2895 static int fromFile
= 0;
2896 static FILE *wordFile
= NULL
;
2899 LOCAL_ARRAY(char, buf
, 256);
2904 t
= (strtok(NULL
, w_space
));
2906 if (!t
|| *t
== '#') {
2908 } else if (*t
== '\"' || *t
== '\'') {
2909 /* quote found, start reading from file */
2912 while (*t
&& *t
!= '\"' && *t
!= '\'')
2917 if ((wordFile
= fopen(fn
, "r")) == NULL
) {
2918 debug(28, 0) ("strtokFile: %s not found\n", fn
);
2922 #ifdef _SQUID_WIN32_
2923 setmode(fileno(wordFile
), O_TEXT
);
2934 if (fgets(buf
, 256, wordFile
) == NULL
) {
2935 /* stop reading from file */
2943 /* skip leading and trailing white space */
2944 t
+= strspn(buf
, w_space
);
2945 t2
= t
+ strcspn(t
, w_space
);
2946 t3
= t2
+ strspn(t2
, w_space
);
2948 while (*t3
&& *t3
!= '#') {
2949 t2
= t3
+ strcspn(t3
, w_space
);
2950 t3
= t2
+ strspn(t2
, w_space
);
2959 /* skip blank lines */
2967 #include "AccessLogEntry.h"
2968 /* TODO: split out parsing somehow ...*/
2970 parse_logformat(logformat
** logformat_definitions
)
2975 if ((name
= strtok(NULL
, w_space
)) == NULL
)
2978 if ((def
= strtok(NULL
, "\r\n")) == NULL
)
2981 debug(3, 1) ("Logformat for '%s' is '%s'\n", name
, def
);
2983 nlf
= (logformat
*)xcalloc(1, sizeof(logformat
));
2985 nlf
->name
= xstrdup(name
);
2987 if (!accessLogParseLogFormat(&nlf
->format
, def
))
2990 nlf
->next
= *logformat_definitions
;
2992 *logformat_definitions
= nlf
;
2996 parse_access_log(customlog
** logs
)
2998 const char *filename
, *logdef_name
;
3002 cl
= (customlog
*)xcalloc(1, sizeof(*cl
));
3004 if ((filename
= strtok(NULL
, w_space
)) == NULL
)
3007 if (strcmp(filename
, "none") == 0) {
3008 cl
->type
= CLF_NONE
;
3012 if ((logdef_name
= strtok(NULL
, w_space
)) == NULL
)
3013 logdef_name
= "auto";
3015 debug(3, 9) ("Log definition name '%s' file '%s'\n", logdef_name
, filename
);
3017 cl
->filename
= xstrdup(filename
);
3019 /* look for the definition pointer corresponding to this name */
3020 lf
= Config
.Log
.logformats
;
3022 while (lf
!= NULL
) {
3023 debug(3, 9) ("Comparing against '%s'\n", lf
->name
);
3025 if (strcmp(lf
->name
, logdef_name
) == 0)
3032 cl
->type
= CLF_CUSTOM
;
3034 } else if (strcmp(logdef_name
, "auto") == 0) {
3035 cl
->type
= CLF_AUTO
;
3036 } else if (strcmp(logdef_name
, "squid") == 0) {
3037 cl
->type
= CLF_SQUID
;
3038 } else if (strcmp(logdef_name
, "common") == 0) {
3039 cl
->type
= CLF_COMMON
;
3041 debug(3, 0) ("Log format '%s' is not defined\n", logdef_name
);
3046 aclParseAclList(&cl
->aclList
);
3049 logs
= &(*logs
)->next
;
3055 check_null_access_log(customlog
*customlog_definitions
)
3057 return customlog_definitions
== NULL
;
3061 dump_logformat(StoreEntry
* entry
, const char *name
, logformat
* definitions
)
3063 accessLogDumpLogFormat(entry
, name
, definitions
);
3067 dump_access_log(StoreEntry
* entry
, const char *name
, customlog
* logs
)
3071 for (log
= logs
; log
; log
= log
->next
) {
3072 storeAppendPrintf(entry
, "%s ", name
);
3074 switch (log
->type
) {
3077 storeAppendPrintf(entry
, "%s %s", log
->filename
, log
->logFormat
->name
);
3081 storeAppendPrintf(entry
, "none");
3085 storeAppendPrintf(entry
, "%s squid", log
->filename
);
3089 storeAppendPrintf(entry
, "%s squid", log
->filename
);
3095 storeAppendPrintf(entry
, "%s auto", log
->filename
);
3097 storeAppendPrintf(entry
, "%s", log
->filename
);
3106 dump_acl_list(entry
, log
->aclList
);
3108 storeAppendPrintf(entry
, "\n");
3113 free_logformat(logformat
** definitions
)
3115 while (*definitions
) {
3116 logformat
*format
= *definitions
;
3117 *definitions
= format
->next
;
3118 accessLogFreeLogFormat(&format
->format
);
3124 free_access_log(customlog
** definitions
)
3126 while (*definitions
) {
3127 customlog
*log
= *definitions
;
3128 *definitions
= log
->next
;
3130 log
->logFormat
= NULL
;
3131 log
->type
= CLF_UNKNOWN
;
3134 aclDestroyAclList(&log
->aclList
);
3136 safe_free(log
->filename
);