]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
config fixes in progress
authorwessels <>
Sun, 6 Jul 1997 11:14:06 +0000 (11:14 +0000)
committerwessels <>
Sun, 6 Jul 1997 11:14:06 +0000 (11:14 +0000)
ChangeLog
src/Makefile.in
src/acl.cc
src/cache_cf.cc
src/cf.data.pre
src/cf_gen.cc

index dd693674a3465c273d19ab1d86c79c23d7a855c8..fbf3b6a1426ad78bae669e471030781d1dee7620 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,8 @@ Changes to squid-1.2.alpha4 ():
        - Replace frequent gettimeofday() calls with alarm(3) based
          clock.  Need to add more gettimeofday() calls to get back
          high-resolution timestamp logging (Andres Kroonmaa).
+       - Added support for Cache-control: proxy-revalidate;
+         based on squid-1.1 patch from Mike Mitchell.
 
 Changes to squid-1.2.alpha3 ():
 
index 4ca6bbce80a089dfd03f9b7b85bb0c38aba5feb5..5583865a7580d8e98470a689a6799a4b7f0ed1e8 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.79 1997/06/26 22:41:35 wessels Exp $
+#  $Id: Makefile.in,v 1.80 1997/07/06 05:14:07 wessels Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -129,15 +129,7 @@ OBJS               = \
 
 DEFAULTS        = \
        -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" \
-       -DDEFAULT_MIME_TABLE=\"$(DEFAULT_MIME_TABLE)\" \
-       -DDEFAULT_DNSSERVER=\"$(DEFAULT_DNSSERVER)\" \
-       -DDEFAULT_CACHE_LOG=\"$(DEFAULT_CACHE_LOG)\" \
-       -DDEFAULT_ACCESS_LOG=\"$(DEFAULT_ACCESS_LOG)\" \
-       -DDEFAULT_STORE_LOG=\"$(DEFAULT_STORE_LOG)\" \
-       -DDEFAULT_PID_FILE=\"$(DEFAULT_PID_FILE)\" \
-       -DDEFAULT_SWAP_DIR=\"$(DEFAULT_SWAP_DIR)\" \
-       -DDEFAULT_PINGER=\"$(DEFAULT_PINGER)\" \
-       -DDEFAULT_UNLINKD=\"$(DEFAULT_UNLINKD)\"
+       -DDEFAULT_SWAP_DIR=\"$(DEFAULT_SWAP_DIR)\"
 
 all:    squid.conf $(PROGS) $(UTILS) $(SUID_UTILS) $(CGIPROGS)
 
@@ -164,22 +156,9 @@ pinger: pinger.o
 unlinkd: unlinkd.c
        $(CC) $(CFLAGS) -DUNLINK_DAEMON $(srcdir)/unlinkd.c -o $@ $(LDFLAGS)
 
-squid.conf: squid.conf.pre Makefile
-       sed "\
-       s%@DEFAULT_CONFIG_FILE@%$(DEFAULT_CONFIG_FILE)%g;\
-       s%@DEFAULT_MIME_TABLE@%$(DEFAULT_MIME_TABLE)%g;\
-       s%@DEFAULT_DNSSERVER@%$(DEFAULT_DNSSERVER)%g;\
-       s%@DEFAULT_UNLINKD@%$(DEFAULT_UNLINKD)%g;\
-       s%@DEFAULT_PINGER@%$(DEFAULT_PINGER)%g;\
-       s%@DEFAULT_CACHE_LOG@%$(DEFAULT_CACHE_LOG)%g;\
-       s%@DEFAULT_ACCESS_LOG@%$(DEFAULT_ACCESS_LOG)%g;\
-       s%@DEFAULT_STORE_LOG@%$(DEFAULT_STORE_LOG)%g;\
-       s%@DEFAULT_PID_FILE@%$(DEFAULT_PID_FILE)%g;\
-       s%@DEFAULT_SWAP_DIR@%$(DEFAULT_SWAP_DIR)%g" < squid.conf.pre >$@
-
 cache_cf.o: cf_parser.c
 
-cf_parser.c: cf.data cf_gen
+squid.conf cf_parser.c: cf.data cf_gen
        ./cf_gen cf.data
 
 cf_gen: cf_gen.o
@@ -187,7 +166,6 @@ cf_gen: cf_gen.o
 
 cf.data: cf.data.pre Makefile
        sed "\
-       s%@DEFAULT_CONFIG_FILE@%$(DEFAULT_CONFIG_FILE)%g;\
        s%@DEFAULT_MIME_TABLE@%$(DEFAULT_MIME_TABLE)%g;\
        s%@DEFAULT_DNSSERVER@%$(DEFAULT_DNSSERVER)%g;\
        s%@DEFAULT_UNLINKD@%$(DEFAULT_UNLINKD)%g;\
index 38529b9f735608618f737268c05f93d58c01d063..2c1ade36f1ab87fb6ad93311697a13882423e305 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: acl.cc,v 1.100 1997/06/26 22:35:37 wessels Exp $
+ * $Id: acl.cc,v 1.101 1997/07/06 05:14:08 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -118,7 +118,7 @@ strtokFile(void)
            }
            aclFromFile = 1;
        } else {
-           return (t);
+           return t;
        }
     }
     /* aclFromFile */
@@ -132,7 +132,7 @@ strtokFile(void)
        /* skip leading and trailing white space */
        t += strspn(buf, w_space);
        t[strcspn(t, w_space)] = '\0';
-       return (t);
+       return t;
     }
 }
 
@@ -471,7 +471,7 @@ aclParseTimeSpec(void *curlist)
 }
 
 void
-aclParseRegexList(void *curlist, int icase)
+aclParseRegexList(void *curlist)
 {
     relist **Tail;
     relist *q = NULL;
@@ -480,9 +480,15 @@ aclParseRegexList(void *curlist, int icase)
     int errcode;
     int flags = REG_EXTENDED | REG_NOSUB;
     for (Tail = curlist; *Tail; Tail = &((*Tail)->next));
-    if (icase)
-       flags |= REG_ICASE;
     while ((t = strtokFile())) {
+       if (strcmp(t, "-i") == 0) {
+               flags |= REG_ICASE;
+               continue;
+       }
+       if (strcmp(t, "+i") == 0) {
+               flags &= ~REG_ICASE;
+               continue;
+       }
        if ((errcode = regcomp(&comp, t, flags)) != 0) {
            char errbuf[256];
            regerror(errcode, &comp, errbuf, sizeof errbuf);
index 346d97e9ba87fcd5fdb05f41de3c36596085c9c5..19a265a78eeef1437880943c4be1fbb9bf51c222 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cache_cf.cc,v 1.198 1997/06/26 22:41:37 wessels Exp $
+ * $Id: cache_cf.cc,v 1.199 1997/07/06 05:14:09 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
 
 struct SquidConfig Config;
 
-#define DefaultMemMaxSize      (8 << 20)       /* 8 MB */
-#define DefaultMemHighWaterMark 90     /* 90% */
-#define DefaultMemLowWaterMark  75     /* 75% */
-#define DefaultSwapMaxSize     0
-#define DefaultSwapHighWaterMark 95    /* 95% */
-#define DefaultSwapLowWaterMark  90    /* 90% */
-#define DefaultNetdbHigh       1000    /* counts, not percents */
-#define DefaultNetdbLow                 900
-#define DefaultNetdbPeriod       300   /* 5 minutes */
-
-#define DefaultWaisRelayHost   (char *)NULL
-#define DefaultWaisRelayPort   0
-
-#define DefaultReferenceAge    (86400*365)     /* 1 year */
-#define DefaultNegativeTtl     (5 * 60)        /* 5 min */
-#define DefaultNegativeDnsTtl  (2 * 60)        /* 2 min */
-#define DefaultPositiveDnsTtl  (360 * 60)      /* 6 hours */
-#define DefaultReadTimeout      (15 * 60)      /* 15 min */
-#define DefaultConnectTimeout   120    /* 2 min */
-#define DefaultDeferTimeout     3600   /* 1 hour */
-#define DefaultRequestTimeout   30     /* 30 seconds */
-#define DefaultClientLifetime   86400  /* 1 day */
-#define DefaultShutdownLifetime 30     /* 30 seconds */
-#define DefaultCleanRate        -1     /* disabled */
-#define DefaultDnsChildren     5       /* 5 processes */
-#define DefaultOptionsResDefnames 0    /* default off */
-#define DefaultOptionsAnonymizer  0    /* default off */
-#define DefaultRedirectChildren        5       /* 5 processes */
-#define DefaultMaxRequestSize  (100 << 10)     /* 100Kb */
-
-#define DefaultHttpPortNum     CACHE_HTTP_PORT
-#define DefaultIcpPortNum      CACHE_ICP_PORT
-
-#define DefaultLogLogFqdn      0       /* default off */
-#define DefaultCacheLogFile    DEFAULT_CACHE_LOG
-#define DefaultAccessLogFile   DEFAULT_ACCESS_LOG
-#define DefaultUseragentLogFile        (char *)NULL    /* default NONE */
-#define DefaultStoreLogFile    DEFAULT_STORE_LOG
-#define DefaultSwapLogFile     (char *)NULL    /* default swappath(0) */
-#if USE_PROXY_AUTH
-#define DefaultProxyAuthFile    (char *)NULL   /* default NONE */
-#endif /* USE_PROXY_AUTH */
-#define DefaultLogRotateNumber  10
-#define DefaultAdminEmail      "webmaster"
-#define DefaultDnsserverProgram DEFAULT_DNSSERVER
-#define DefaultPingerProgram    DEFAULT_PINGER
-#define DefaultUnlinkdProgram   DEFAULT_UNLINKD
-#define DefaultRedirectProgram  (char *)NULL   /* default NONE */
-#define DefaultEffectiveUser   (char *)NULL    /* default NONE */
-#define DefaultEffectiveGroup  (char *)NULL    /* default NONE */
-#define DefaultAppendDomain    (char *)NULL    /* default NONE */
-#define DefaultErrHtmlText     (char *)NULL    /* default NONE */
-
-#define DefaultDebugOptions    "ALL,1"         /* All sections at level 1 */
-#define DefaultAccelHost       (char *)NULL    /* default NONE */
-#define DefaultAccelPrefix     (char *)NULL    /* default NONE */
-#define DefaultAccelPort       0       /* default off */
-#define DefaultAccelWithProxy  0       /* default off */
-#define DefaultSourcePing      0       /* default off */
-#define DefaultCommonLogFormat 0       /* default off */
-#define DefaultLogMimeHdrs     0       /* default off */
-#define DefaultIdentLookup     0       /* default off */
-#define DefaultQuickAbortMin   -1      /* default off */
-#define DefaultQuickAbortPct   0       /* default off */
-#define DefaultQuickAbortMax   0       /* default off */
-#define DefaultNeighborTimeout  2      /* 2 seconds */
-#define DefaultStallDelay      1       /* 1 seconds */
-#define DefaultSingleParentBypass 0    /* default off */
-#define DefaultPidFilename      DEFAULT_PID_FILE
-#define DefaultMimeTable        DEFAULT_MIME_TABLE
-#define DefaultVisibleHostname  (char *)NULL   /* default NONE */
-#define DefaultFtpAnonUser     "squid@"        /* Default without domain */
-#define DefaultAnnounceHost    "sd.cache.nlanr.net"
-#define DefaultAnnouncePort    3131
-#define DefaultAnnounceFile    (char *)NULL    /* default NONE */
-#define DefaultAnnounceRate    0       /* Default off */
-#define DefaultTcpRcvBufsz     0       /* use system default */
-#define DefaultUdpMaxHitObjsz  SQUID_UDP_SO_SNDBUF     /* from configure */
-#define DefaultTcpIncomingAddr INADDR_ANY
-#define DefaultTcpOutgoingAddr no_addr.s_addr
-#define DefaultUdpIncomingAddr INADDR_ANY
-#define DefaultUdpOutgoingAddr no_addr.s_addr
-#define DefaultClientNetmask    0xFFFFFFFFul
-#define DefaultPassProxy       NULL
-#define DefaultSslProxy                NULL
-#define DefaultIpcacheSize     1024
-#define DefaultIpcacheLow      90
-#define DefaultIpcacheHigh     95
-#define DefaultMinDirectHops   4
-#define DefaultMaxObjectSize   (4<<20)         /* 4Mb */
-#define DefaultAvgObjectSize   20      /* 20k */
-#define DefaultObjectsPerBucket        50
-
-#define DefaultOptionsLogUdp   1       /* on */
-#define DefaultOptionsEnablePurge 0    /* default off */
-#define DefaultOptionsClientDb 1       /* default on */
-#define DefaultOptionsQueryIcmp        0       /* default off */
-
-#define DefaultFtpIconPrefix   "internal-"
-#define DefaultFtpIconSuffix   null_string
-#define DefaultFtpListWidth    32
-#define DefaultFtpListWrap     0
-
 static const char *const T_SECOND_STR = "second";
 static const char *const T_MINUTE_STR = "minute";
 static const char *const T_HOUR_STR = "hour";
@@ -231,12 +128,10 @@ char config_input_line[BUFSIZ];
 int config_lineno = 0;
 
 static char fatal_str[BUFSIZ];
-static char *safe_xstrdup _PARAMS((const char *p));
 static void self_destruct _PARAMS((void));
 static void wordlistAdd _PARAMS((wordlist **, const char *));
 
 static void configDoConfigure _PARAMS((void));
-static void configSetFactoryDefaults _PARAMS((void));
 static void parseRefreshPattern _PARAMS((int icase));
 static int parseTimeUnits _PARAMS((const char *unit));
 static void parseTimeLine _PARAMS((int *iptr, const char *units));
@@ -245,7 +140,12 @@ static void parse_string _PARAMS((char **));
 static void parse_wordlist _PARAMS((wordlist **));
 static void dump_all _PARAMS((void));
 static void default_all _PARAMS((void));
-static int parse_line _PARAMS((char[]));
+static int parse_line _PARAMS((char *));
+
+/* These come from cf_gen.c */
+static void default_all _PARAMS((void));
+static void dump_all _PARAMS((void));
+static void free_all _PARAMS((void));
 
 static void
 self_destruct(void)
@@ -345,8 +245,8 @@ parseConfigFile(const char *file_name)
     char *token = NULL;
     LOCAL_ARRAY(char, tmp_line, BUFSIZ);
 
-    configFreeMemory();
-    configSetFactoryDefaults();
+    free_all();
+    default_all();
     aclDestroyAcls();
     aclDestroyDenyInfoList(&Config.denyInfoList);
     aclDestroyAccessList(&Config.accessList.HTTP);
@@ -430,162 +330,6 @@ parseConfigFile(const char *file_name)
     return 0;
 }
 
-static char *
-safe_xstrdup(const char *p)
-{
-    return p ? xstrdup(p) : NULL;
-}
-
-void
-configFreeMemory(void)
-{
-    safe_free(Config.Wais.relayHost);
-    safe_free(Config.Log.log);
-    safe_free(Config.Log.access);
-    safe_free(Config.Log.store);
-    safe_free(Config.Log.swap);
-    safe_free(Config.adminEmail);
-    safe_free(Config.effectiveUser);
-    safe_free(Config.effectiveGroup);
-    safe_free(Config.Program.dnsserver);
-    safe_free(Config.Program.redirect);
-    safe_free(Config.Program.unlinkd);
-    safe_free(Config.Program.pinger);
-    safe_free(Config.Accel.host);
-    safe_free(Config.Accel.prefix);
-    safe_free(Config.appendDomain);
-    safe_free(Config.debugOptions);
-    safe_free(Config.pidFilename);
-    safe_free(Config.mimeTablePathname);
-    safe_free(Config.visibleHostname);
-#if USE_PROXY_AUTH
-    safe_free(Config.proxyAuth.File);
-    aclDestroyRegexList(Config.proxyAuth.IgnoreDomains);
-    Config.proxyAuth.IgnoreDomains = NULL;
-#endif /* USE_PROXY_AUTH */
-    safe_free(Config.Announce.host);
-    safe_free(Config.Announce.file);
-    safe_free(Config.errHtmlText);
-    safe_free(Config.Ftp.icon_prefix);
-    safe_free(Config.Ftp.icon_suffix);
-    safe_free(Config.Ftp.anon_user);
-    peerDestroy(Config.sslProxy);
-    peerDestroy(Config.passProxy);
-    wordlistDestroy(&Config.hierarchy_stoplist);
-    wordlistDestroy(&Config.mcast_group_list);
-    wordlistDestroy(&Config.dns_testname_list);
-    wordlistDestroy(&Config.cache_stoplist);
-    objcachePasswdDestroy(&Config.passwd_list);
-    refreshFreeMemory();
-}
-
-
-static void
-configSetFactoryDefaults(void)
-{
-    memset(&Config, '\0', sizeof(Config));
-    Config.Mem.maxSize = DefaultMemMaxSize;
-    Config.Mem.highWaterMark = DefaultMemHighWaterMark;
-    Config.Mem.lowWaterMark = DefaultMemLowWaterMark;
-    Config.Swap.maxSize = DefaultSwapMaxSize;
-    Config.Swap.highWaterMark = DefaultSwapHighWaterMark;
-    Config.Swap.lowWaterMark = DefaultSwapLowWaterMark;
-    Config.Netdb.high = DefaultNetdbHigh;
-    Config.Netdb.low = DefaultNetdbLow;
-    Config.Netdb.period = DefaultNetdbPeriod;
-
-    Config.Wais.relayHost = safe_xstrdup(DefaultWaisRelayHost);
-    Config.Wais.relayPort = DefaultWaisRelayPort;
-
-    Config.referenceAge = DefaultReferenceAge;
-    Config.negativeTtl = DefaultNegativeTtl;
-    Config.negativeDnsTtl = DefaultNegativeDnsTtl;
-    Config.positiveDnsTtl = DefaultPositiveDnsTtl;
-    Config.Timeout.read = DefaultReadTimeout;
-    Config.Timeout.connect = DefaultConnectTimeout;
-    Config.Timeout.defer = DefaultDeferTimeout;
-    Config.Timeout.request = DefaultRequestTimeout;
-    Config.Timeout.lifetime = DefaultClientLifetime;
-    Config.shutdownLifetime = DefaultShutdownLifetime;
-    Config.maxRequestSize = DefaultMaxRequestSize;
-    Config.cleanRate = DefaultCleanRate;
-    Config.dnsChildren = DefaultDnsChildren;
-    Config.redirectChildren = DefaultRedirectChildren;
-    Config.sourcePing = DefaultSourcePing;
-    Config.quickAbort.min = DefaultQuickAbortMin;
-    Config.quickAbort.pct = DefaultQuickAbortPct;
-    Config.quickAbort.max = DefaultQuickAbortMax;
-    Config.commonLogFormat = DefaultCommonLogFormat;
-    Config.logMimeHdrs = DefaultLogMimeHdrs;
-    Config.identLookup = DefaultIdentLookup;
-    Config.debugOptions = safe_xstrdup(DefaultDebugOptions);
-    Config.neighborTimeout = DefaultNeighborTimeout;
-    Config.stallDelay = DefaultStallDelay;
-    Config.singleParentBypass = DefaultSingleParentBypass;
-    Config.adminEmail = safe_xstrdup(DefaultAdminEmail);
-    Config.effectiveUser = safe_xstrdup(DefaultEffectiveUser);
-    Config.effectiveGroup = safe_xstrdup(DefaultEffectiveGroup);
-    Config.appendDomain = safe_xstrdup(DefaultAppendDomain);
-    Config.errHtmlText = safe_xstrdup(DefaultErrHtmlText);
-    Config.Port.icp = DefaultIcpPortNum;
-    Config.Log.log_fqdn = DefaultLogLogFqdn;
-    Config.Log.log = safe_xstrdup(DefaultCacheLogFile);
-    Config.Log.access = safe_xstrdup(DefaultAccessLogFile);
-    Config.Log.store = safe_xstrdup(DefaultStoreLogFile);
-    Config.Log.swap = safe_xstrdup(DefaultSwapLogFile);
-#if USE_USERAGENT_LOG
-    Config.Log.useragent = safe_xstrdup(DefaultUseragentLogFile);
-#endif
-    Config.Log.rotateNumber = DefaultLogRotateNumber;
-    Config.Program.dnsserver = safe_xstrdup(DefaultDnsserverProgram);
-    Config.Program.redirect = safe_xstrdup(DefaultRedirectProgram);
-    Config.Program.pinger = safe_xstrdup(DefaultPingerProgram);
-    Config.Program.unlinkd = safe_xstrdup(DefaultUnlinkdProgram);
-    Config.Accel.host = safe_xstrdup(DefaultAccelHost);
-    Config.Accel.prefix = safe_xstrdup(DefaultAccelPrefix);
-    Config.Accel.port = DefaultAccelPort;
-    Config.Accel.withProxy = DefaultAccelWithProxy;
-    Config.pidFilename = safe_xstrdup(DefaultPidFilename);
-    Config.mimeTablePathname = safe_xstrdup(DefaultMimeTable);
-    Config.visibleHostname = safe_xstrdup(DefaultVisibleHostname);
-#if USE_PROXY_AUTH
-    Config.proxyAuth.File = safe_xstrdup(DefaultProxyAuthFile);
-/*    Config.proxyAuth.IgnoreDomains = safe_xstrdup(DefaultproxyAuthIgnoreDomains); */
-#endif /* USE_PROXY_AUTH */
-    Config.Announce.host = safe_xstrdup(DefaultAnnounceHost);
-    Config.Announce.port = DefaultAnnouncePort;
-    Config.Announce.file = safe_xstrdup(DefaultAnnounceFile);
-    Config.Announce.rate = DefaultAnnounceRate;
-    Config.Announce.on = 0;
-    Config.tcpRcvBufsz = DefaultTcpRcvBufsz;
-    Config.udpMaxHitObjsz = DefaultUdpMaxHitObjsz;
-    Config.Addrs.tcp_outgoing.s_addr = DefaultTcpOutgoingAddr;
-    Config.Addrs.tcp_incoming.s_addr = DefaultTcpIncomingAddr;
-    Config.Addrs.udp_outgoing.s_addr = DefaultUdpOutgoingAddr;
-    Config.Addrs.udp_incoming.s_addr = DefaultUdpIncomingAddr;
-    Config.Addrs.client_netmask.s_addr = DefaultClientNetmask;
-    Config.passProxy = DefaultPassProxy;
-    Config.sslProxy = DefaultSslProxy;
-    Config.ipcache.size = DefaultIpcacheSize;
-    Config.ipcache.low = DefaultIpcacheLow;
-    Config.ipcache.high = DefaultIpcacheHigh;
-    Config.minDirectHops = DefaultMinDirectHops;
-    Config.Store.maxObjectSize = DefaultMaxObjectSize;
-    Config.Store.avgObjectSize = DefaultAvgObjectSize;
-    Config.Store.objectsPerBucket = DefaultObjectsPerBucket;
-    Config.Options.log_udp = DefaultOptionsLogUdp;
-    Config.Options.res_defnames = DefaultOptionsResDefnames;
-    Config.Options.anonymizer = DefaultOptionsAnonymizer;
-    Config.Options.enable_purge = DefaultOptionsEnablePurge;
-    Config.Options.client_db = DefaultOptionsClientDb;
-    Config.Options.query_icmp = DefaultOptionsQueryIcmp;
-    Config.Ftp.icon_prefix = safe_xstrdup(DefaultFtpIconPrefix);
-    Config.Ftp.icon_suffix = safe_xstrdup(DefaultFtpIconSuffix);
-    Config.Ftp.list_width = DefaultFtpListWidth;
-    Config.Ftp.list_wrap = DefaultFtpListWrap;
-    Config.Ftp.anon_user = safe_xstrdup(DefaultFtpAnonUser);
-}
-
 static void
 configDoConfigure(void)
 {
@@ -684,6 +428,12 @@ parse_acl_access(struct _acl_access **head)
     aclParseAccessLine(head);
 }
 
+static void
+free_acl_access(struct _acl_access **head)
+{
+       aclDestroyAccessList(head);
+}
+
 static void
 dump_address(struct in_addr addr)
 {
@@ -706,6 +456,12 @@ parse_address(struct in_addr *addr)
        self_destruct();
 }
 
+static void
+free_address(struct in_addr *addr)
+{
+       memset(addr, '\0', sizeof(struct in_addr));
+}
+
 static void
 dump_announceto(void)
 {
@@ -808,61 +564,75 @@ parse_cachedir(void)
 }
 
 static void
-dump_cachehost(void)
+dump_cache_peer(struct cache_peer *p)
 {
     debug(0,0)("XXX need to fix\n");
 }
 
 static void
-parse_cachehost(void)
+parse_cache_peer(struct cache_peer **head)
 {
-    char *type = NULL;
-    char *hostname = NULL;
     char *token = NULL;
-    u_short http_port = CACHE_HTTP_PORT;
-    u_short icp_port = CACHE_ICP_PORT;
-    int options = 0;
-    int weight = 1;
-    int mcast_ttl = 0;
+    struct cache_peer peer;
+    struct cache_peer *p;
     int i;
-
-    if (!(hostname = strtok(NULL, w_space)))
+    memset(&peer, '\0', sizeof(struct cache_peer));
+    peer.http = CACHE_HTTP_PORT;
+    peer.icp = CACHE_ICP_PORT;
+    peer.weight = 1;
+    if (!(peer.host = strtok(NULL, w_space))) 
        self_destruct();
-    if (!(type = strtok(NULL, w_space)))
+    if (!(peer.type = strtok(NULL, w_space)))
        self_destruct();
-
     GetInteger(i);
-    http_port = (u_short) i;
+    peer.http = (u_short) i;
     GetInteger(i);
-    icp_port = (u_short) i;
+    peer.icp = (u_short) i;
     while ((token = strtok(NULL, w_space))) {
        if (!strcasecmp(token, "proxy-only")) {
-           options |= NEIGHBOR_PROXY_ONLY;
+           peer.options |= NEIGHBOR_PROXY_ONLY;
        } else if (!strcasecmp(token, "no-query")) {
-           options |= NEIGHBOR_NO_QUERY;
+           peer.options |= NEIGHBOR_NO_QUERY;
        } else if (!strcasecmp(token, "multicast-responder")) {
-           options |= NEIGHBOR_MCAST_RESPONDER;
+           peer.options |= NEIGHBOR_MCAST_RESPONDER;
        } else if (!strncasecmp(token, "weight=", 7)) {
-           weight = atoi(token + 7);
+           peer.weight = atoi(token + 7);
        } else if (!strncasecmp(token, "ttl=", 4)) {
-           mcast_ttl = atoi(token + 4);
-           if (mcast_ttl < 0)
-               mcast_ttl = 0;
-           if (mcast_ttl > 128)
-               mcast_ttl = 128;
+           peer.mcast_ttl = atoi(token + 4);
+           if (peer.mcast_ttl < 0)
+               peer.mcast_ttl = 0;
+           if (peer.mcast_ttl > 128)
+               peer.mcast_ttl = 128;
        } else if (!strncasecmp(token, "default", 7)) {
-           options |= NEIGHBOR_DEFAULT_PARENT;
+           peer.options |= NEIGHBOR_DEFAULT_PARENT;
        } else if (!strncasecmp(token, "round-robin", 11)) {
-           options |= NEIGHBOR_ROUNDROBIN;
+           peer.options |= NEIGHBOR_ROUNDROBIN;
        } else {
-           debug(3, 0) ("parseCacheHostLine: token='%s'\n", token);
+           debug(3, 0) ("parse_cache_peer: token='%s'\n", token);
            self_destruct();
        }
     }
-    if (weight < 1)
-       weight = 1;
-    neighborAdd(hostname, type, http_port, icp_port, options,
-       weight, mcast_ttl);
+    if (peer.weight < 1)
+       peer.weight = 1;
+    p = xcalloc(1, sizeof(struct cache_peer));
+    *p = peer;
+    p->host = xstrdup(peer.host);
+    p->type = xstrdup(peer.type);
+    while (*head != NULL)
+       head = &(*head)->next;
+    *head = p;
+}
+
+static void
+free_cache_peer(struct cache_peer **P)
+{
+       struct cache_peer *p;
+       while ((p = *P)) {
+               *P = p->next;
+               xfree(p->host);
+               xfree(p->type);
+               xfree(p);
+       }
 }
 
 static void
@@ -894,28 +664,6 @@ parse_denyinfo(struct _acl_deny_info_list **var)
     aclParseDenyInfoLine(var);
 }
 
-static void
-dump_effectiveuser(void)
-{
-    debug(0,0)("XXX need to fix\n");
-}
-
-static void
-parse_effectiveuser(void)
-{
-    char *token;
-    token = strtok(NULL, w_space);
-    if (token == NULL)
-       self_destruct();
-    safe_free(Config.effectiveUser);
-    safe_free(Config.effectiveGroup);
-    Config.effectiveUser = xstrdup(token);
-    token = strtok(NULL, w_space);
-    if (token == NULL)
-       return;                 /* group is optional */
-    Config.effectiveGroup = xstrdup(token);
-}
-
 static void
 dump_errhtml(void)
 {
@@ -1068,6 +816,16 @@ parse_ushortlist(ushortlist ** P)
     }
 }
 
+static void
+free_ushortlist(ushortlist **P)
+{
+       ushortlist *u;
+       while ((u = *P)) {
+               *P = u->next;
+               xfree(u);
+       }
+}
+
 static void
 dump_int(int var)
 {
@@ -1084,6 +842,12 @@ parse_int(int *var)
     *var = i;
 }
 
+static void
+free_int(int *var)
+{
+       *var = 0;
+}
+
 static void
 dump_onoff(int var)
 {
@@ -1103,107 +867,21 @@ parse_onoff(int *var)
        *var = 0;
 }
 
-static void
-dump_pathname_check(char path[])
-{
-    printf("%s", path);
-}
+#define free_onoff free_int
+#define dump_pathname_stat dump_string
+#define free_pathname_stat free_string
 
 static void
-parse_pathname_check(char *path[])
+parse_pathname_stat(char **path)
 {
     struct stat sb;
-
     parse_string(path);
-
     if (stat(*path, &sb) < 0) {
-       debug(50, 1) ("parse_pathname_check: %s: %s\n", *path, xstrerror());
+       debug(50, 1) ("parse_pathname_stat: %s: %s\n", *path, xstrerror());
        self_destruct();
     }
 }
 
-static void
-dump_proxy(peer * E)
-{
-    debug(0,0)("XXX need to fix\n");
-}
-
-static void
-parse_proxy(peer ** E)
-{
-    char *token;
-    char *t;
-    peer *e;
-    token = strtok(NULL, w_space);
-    if (token == NULL)
-       self_destruct();
-    if (*E) {
-       peerDestroy(*E);
-       *E = NULL;
-    }
-    e = xcalloc(1, sizeof(peer));
-    if ((t = strchr(token, ':'))) {
-       *t++ = '\0';
-       e->http_port = atoi(t);
-    }
-    e->host = xstrdup(token);
-    e->tcp_up = 1;
-    *E = e;
-}
-
-#if USE_PROXY_AUTH
-static void
-dump_proxyauth(void)
-{
-    debug(0,0)("XXX need to fix\n");
-}
-
-static void
-parse_proxyauth(void)
-{
-    char *token;
-    token = strtok(NULL, w_space);
-    if (token == NULL)
-       self_destruct();
-    safe_free(Config.proxyAuth.File);
-    aclDestroyRegexList(Config.proxyAuth.IgnoreDomains);
-    Config.proxyAuth.IgnoreDomains = NULL;
-    Config.proxyAuth.File = xstrdup(token);
-    aclParseRegexList(&Config.proxyAuth.IgnoreDomains, 1);
-}
-#endif /* USE_PROXY_AUTH */
-
-static void
-dump_quickabort(void)
-{
-    debug(0,0)("XXX need to fix\n");
-}
-
-static void
-parse_quickabort(void)
-{
-    char *token;
-    int i;
-    token = strtok(NULL, w_space);
-    if (!strcasecmp(token, "on")) {
-       Config.quickAbort.min = 10 << 10;       /* 10k */
-       Config.quickAbort.pct = 64;     /* 50% */
-       Config.quickAbort.max = 100 << 10;      /* 100k */
-    } else if (!strcasecmp(token, "off")) {
-       Config.quickAbort.min = -1;
-       Config.quickAbort.pct = 0;
-       Config.quickAbort.max = 0;
-    } else {
-       if (sscanf(token, "%d", &i) != 1)
-           self_destruct();
-       Config.quickAbort.min = i * 1024;
-       GetInteger(i);
-       Config.quickAbort.pct = i * 128 / 100;  /* 128 is full scale */
-       GetInteger(i);
-       Config.quickAbort.max = i * 1024;
-    }
-}
-
 static void
 dump_refreshpattern(void)
 {
@@ -1237,38 +915,38 @@ dump_regexlist(relist * var)
 static void
 parse_regexlist(relist ** var)
 {
-    aclParseRegexList(var, 0);
+    aclParseRegexList(var);
 }
 
 static void
-dump_regexlist_icase(relist * var)
+free_regexlist(relist ** var)
 {
-    debug(0,0)("XXX need to fix\n");
+    aclDestroyRegexList(*var);
+    *var = NULL;
 }
 
 static void
-parse_regexlist_icase(relist ** var)
-{
-    aclParseRegexList(var, 1);
-}
-
-static void
-dump_string(char var[])
+dump_string(char *var)
 {
     printf("%s", var);
 }
 
 static void
-parse_string(char *var[])
+parse_string(char **var)
 {
     char *token = strtok(NULL, w_space);
-
     safe_free(*var);
     if (token == NULL)
        self_destruct();
     *var = xstrdup(token);
 }
 
+static void
+free_string(char **var)
+{
+       xfree(*var);
+       *var = NULL;
+}
 static void
 dump_string_optional(const char *var)
 {
@@ -1276,10 +954,9 @@ dump_string_optional(const char *var)
 }
 
 static void
-parse_string_optional(char *volatile *var)
+parse_volatile_string(char *volatile *var)
 {
     char *token = strtok(NULL, null_string);
-
     safe_free(*var);
     if (token == NULL) {
        *var = NULL;
@@ -1318,6 +995,12 @@ dump_ushort(u_short var)
     printf("%d", var);
 }
 
+static void
+free_ushort(u_short *u)
+{
+    *u = 0;
+}
+
 static void
 parse_ushort(u_short * var)
 {
@@ -1362,26 +1045,6 @@ parse_vizhack(void)
        Config.vizHack.mcast_ttl = i;
 }
 
-static void
-dump_waisrelay(void)
-{
-    debug(0,0)("XXX need to fix\n");
-}
-
-static void
-parse_waisrelay(void)
-{
-    char *token;
-    int i;
-    token = strtok(NULL, w_space);
-    if (token == NULL)
-       self_destruct();
-    safe_free(Config.Wais.relayHost);
-    Config.Wais.relayHost = xstrdup(token);
-    GetInteger(i);
-    Config.Wais.relayPort = (u_short) i;
-}
-
 static void
 dump_wordlist(wordlist * list)
 {
@@ -1402,16 +1065,6 @@ parse_wordlist(wordlist ** list)
        wordlistAdd(list, token);
 }
 
-static void
-parse_proxyauth(void)
-{
-       fatal("not implemented");
-}
-
-static void
-dump_proxyauth(void)
-{
-       fatal("not implemented");
-}
+#define free_wordlist wordlistDestroy
 
 #include "cf_parser.c"
index 2bb885cfb4c51a588ca75098a2dfe8f348198da1..f584b339bef2fac431f888d1cae5cd5c375f5192 100644 (file)
@@ -107,8 +107,10 @@ DOC_END
 # OPTIONS WHICH AFFECT THE NEIGHBOR SELECTION ALGORITHM
 #-----------------------------------------------------------------------------
 
-NAME: cache_host
-TYPE: cachehost
+NAME: cache_peer cache_host
+TYPE: cache_peer
+DEFAULT: NULL
+LOC: Config.peers
 DOC_START
        To specify other caches in a hierarchy, use the format:
 
@@ -303,6 +305,7 @@ DOC_END
 
 NAME: hierarchy_stoplist
 TYPE: wordlist
+DEFAULT: NULL
 LOC: Config.hierarchy_stoplist
 DOC_START
        A list of words which, if found in a URL, cause the object to
@@ -318,6 +321,7 @@ DOC_END
 
 NAME: cache_stoplist
 TYPE: wordlist
+DEFAULT: NULL
 LOC: Config.cache_stoplist
 DOC_START
        A list of words which, if found in a URL, cause the object to
@@ -332,18 +336,13 @@ DOC_END
 
 
 NAME: cache_stoplist_pattern
-COMMENT: # case sensitive
 TYPE: regexlist
 LOC: Config.cache_stop_relist
-DOC_NONE
-
-NAME: cache_stoplist_pattern/i
-COMMENT: # case insensitive
-TYPE: regexlist_icase
-LOC: Config.cache_stop_relist
+DEFAULT: NULL
 DOC_START
        Just like 'cache_stoplist' but you can use regular expressions
        instead of simple string matching.  There is no default.
+       Insert -i to get case-insensitive regular expressions.
 
 cache_stoplist_pattern
 DOC_END
@@ -478,6 +477,7 @@ DOC_END
 
 NAME: cache_dir
 TYPE: cachedir
+DEFAULT: NULL
 DOC_START
        Directory for on-disk cache storage.  The cache will change into
        this directory when running.  The default is
@@ -486,7 +486,7 @@ DOC_START
        You can specify multiple cache_dir lines to spread the
        cache among different disk partitions.
 
-cache_dir /usr/local/squid/cache 256 16 16
+cache_dir /usr/local/squid/cache 1000 256 16
 DOC_END
 
 
@@ -504,31 +504,32 @@ DOC_END
 
 NAME: cache_log
 TYPE: string
-DEFAULT: /usr/local/squid/logs/cache.log
+DEFAULT: @DEFAULT_CACHE_LOG@
 LOC: Config.Log.log
 DOC_START
        Cache logging file.  Set logging levels with "debug_options" below.
 
-cache_log /usr/local/squid/logs/cache.log
+cache_log @DEFAULT_CACHE_LOG@
 DOC_END
 
 
 NAME: cache_store_log
 TYPE: string
-DEFAULT: /usr/local/squid/logs/store.log
+DEFAULT: @DEFAULT_STORE_LOG@
 LOC: Config.Log.store
 DOC_START
        Logs the activities of the storage manager.  Shows which
        objects are ejected from the cache, and which objects are
        saved and for how long.  To disable, enter "none".
 
-cache_store_log /usr/local/squid/logs/store.log
+cache_store_log @DEFAULT_STORE_LOG@
 DOC_END
 
 
 NAME: cache_swap_log
 TYPE: string
 LOC: Config.Log.swap
+DEFAULT: NULL
 DOC_START
        Location for the cache "swap log."  This log file holds the
        metadata of objects saved on disk.  It is used to rebuild the
@@ -557,15 +558,15 @@ DOC_END
 
 
 NAME: mime_table
-TYPE: pathname_check
-DEFAULT: /usr/local/squid/etc/mime.conf
+TYPE: pathname_stat
+DEFAULT: @DEFAULT_MIME_TABLE@
 LOC: Config.mimeTablePathname
 DOC_START
        Pathname to Squid's MIME table which has the format
 
            regex content-type icon content-encoding transfer-mode
 
-mime_table /usr/local/squid/etc/mime.conf
+mime_table @DEFAULT_MIME_TABLE@
 DOC_END
 
 
@@ -602,12 +603,12 @@ DOC_END
 
 NAME: pid_filename
 TYPE: string
-DEFAULT: /usr/local/squid/logs/squid.pid
+DEFAULT: @DEFAULT_PID_FILE@
 LOC: Config.pidFilename
 DOC_START
        A pathname to write the process-id to.  To disable, enter "none".
 
-pid_filename /usr/local/squid/logs/squid.pid
+pid_filename @DEFAULT_PID_FILE@
 DOC_END
 
 
@@ -706,13 +707,13 @@ DOC_END
 
 
 NAME: cache_dns_program
-TYPE: pathname_check
-DEFAULT: /usr/local/squid/bin/dnsserver
+TYPE: pathname_stat
+DEFAULT: @DEFAULT_DNSSERVER@
 LOC: Config.Program.dnsserver
 DOC_START
        Specify the location of the executable for dnslookup process.
 
-cache_dns_program /usr/local/squid/bin/dnsserver
+cache_dns_program @DEFAULT_DNSSERVER@
 DOC_END
 
 
@@ -751,30 +752,31 @@ DOC_END
 
 
 NAME: unlinkd_program
-TYPE: pathname_check
-DEFAULT: /usr/local/squid/bin/unlinkd
+TYPE: pathname_stat
+DEFAULT: @DEFAULT_UNLINKD@
 LOC: Config.Program.unlinkd
 DOC_START
        Specify the location of the executable for file deletion process.
 
-unlinkd_program /usr/local/squid/bin/unlinkd
+unlinkd_program @DEFAULT_UNLINKD@
 DOC_END
 
 
 NAME: pinger_program
-TYPE: pathname_check
-DEFAULT: /usr/local/squid/bin/pinger
+TYPE: pathname_stat
+DEFAULT: @DEFAULT_PINGER@
 LOC: Config.Program.pinger
 DOC_START
        Specify the location of the executable for the pinger process.
 
-pinger_program /usr/local/squid/bin/pinger
+pinger_program @DEFAULT_PINGER@
 DOC_END
 
 
 NAME: redirect_program
-TYPE: pathname_check
+TYPE: pathname_stat
 LOC: Config.Program.redirect
+DEFAULT: /bin/false
 DOC_START
        Specify the location of the executable for the URL redirector.
        Currently, you must provide your own redirector program.
@@ -798,13 +800,21 @@ DOC_END
 
 # OPTIONS FOR TUNING THE CACHE
 #-----------------------------------------------------------------------------
+NAME: wais_relay_host
+TYPE: string
+DEFAULT: NULL
+LOC: Config.Wais.relayHost
+DOC_NONE
 
-NAME: wais_relay
-TYPE: waisrelay
+NAME: wais_relay_port
+TYPE: ushort
+DEFAULT: 0
+LOC: Config.Wais.relayPort
 DOC_START
        Relay WAIS request to host (1st arg) at port (2 arg).
 
-wais_relay localhost 8000
+wais_relay_host localhost
+wais_relay_port 8000
 DOC_END
 
 
@@ -877,8 +887,25 @@ reference_age 1 year
 DOC_END
 
 
-NAME: quick_abort
-TYPE: quickabort
+NAME: quick_abort_min
+COMMENT: (kbytes)
+TYPE: int
+DEFAULT: -1
+LOC: Config.quickAbort.min
+DOC_NONE
+
+NAME: quick_abort_pct
+COMMENT: (percent)
+TYPE: int
+DEFAULT: 0
+LOC: Config.quickAbort.pct
+DOC_NONE
+
+NAME: quick_abort_max
+COMMENT: (kbytes)
+TYPE: int
+DEFAULT: 0
+LOC: Config.quickAbort.max
 DOC_START
        By default the cache continues to retrieve objects from
        aborted requests.  This may be undesirable on slow (e.g. SLIP)
@@ -902,7 +929,9 @@ DOC_START
        If more than 'percent' of the transfer has completed, it will
        finish the retrieval.
 
-quick_abort    -1 0 0
+quick_abort_min -1
+quick_abort_pct 0
+quick_abort_max 0
 DOC_END
 
 
@@ -1196,13 +1225,22 @@ DOC_END
 
 
 NAME: cache_effective_user
-TYPE: effectiveuser
+TYPE: string
+DEFAULT: NONE
+LOC: Config.effectiveUser
+DOC_NONE
+
+NAME: cache_effective_group
+TYPE: string
+DEFAULT: NONE
+LOC: Config.effectiveGroup
 DOC_START
        If the cache is run as root, it will change its effective/real
        UID/GID to the UID/GID specified below.  The default is not to
        change UID/GID.
 
-cache_effective_user nobody nogroup
+cache_effective_user nobody
+cache_effective_group nogroup
 DOC_END
 
 
@@ -1370,52 +1408,69 @@ DOC_END
 
 
 NAME: ssl_proxy
-TYPE: proxy
+TYPE: cache_peer
 LOC: Config.sslProxy
+DEFAULT: NULL
 DOC_START
-       Specify the name of a 'cache_host' listed above, or a hostname
-       and port number where all SSL requests should be forwarded to.
+       Specify a hostname and port number where all SSL requests
+       should be forwarded to.
+
+       XXX For now, ssl_proxy has the same format as cache_peer
+       because they share the same data structure.  All files
+       must be present in the config file, but some will be ignored.
 
-       Usage: ssl_proxy cache_host
-              ssl_proxy host:port
+       Usage: ssl_proxy hostname type-ignored port icpport-ignored
 
 ssl_proxy
 DOC_END
 
 
 NAME: passthrough_proxy
-TYPE: proxy
+TYPE: cache_peer
 LOC: Config.passProxy
+DEFAULT: NULL
 DOC_START
-       Specify the name of a 'cache_host' listed above, or a hostname
-       and port number where all non-GET (i.e. POST, PUT) requests
-       should be forwarded to.
+       Specify a hostname and port number where all non-GET (i.e.
+       POST, PUT) requests should be forwarded to.
+
+       XXX For now, ssl_proxy has the same format as cache_peer
+       because they share the same data structure.  All files
+       must be present in the config file, but some will be ignored.
 
-       Usage: passthrough_proxy cache_host
-              passthrough_proxy host:port
+       Usage: passthrough_proxy hostname type-ignored port icpport-ignored
 
 passthrough_proxy
 DOC_END
 
 
-NAME: proxy_auth
-TYPE: proxyauth
-DOC_START
-       Usage: proxy_auth passwd_file [ ignore-domain ]
+NAME: proxy_auth_passwd
+TYPE: string
+LOC: Config.proxyAuth.File
+DEFAULT: NULL
+DOC_NONE
 
+NAME: proxy_auth_ignore
+TYPE: regexlist
+LOC: Config.proxyAuth.IgnoreDomains
+DEFAULT: NULL
+DOC_START
        'passwd_file' is an apache-style file of passwords for
        authenticated proxy access Looks like user:password, with the
        password being standard crypt() format.  Proxy authentication
        is disabled by default.
 
-       'ignore-domain' is a domain name for which authorization will
-       *not* be required.
+       'proxy_auth_ignore' is a regular-expression list of domain names
+       (source or destination??)
+       for which authorization will *not* be required.
 
        NOTE, proxy_auth support is not compiled into Squid by default.
        To use this feature you must enable the USE_PROXY_AUTH option
        near the top of src/Makefile.
 
-proxy_auth /dev/null
+       Insert -i to get case-insensitive regular expressions.
+
+proxy_auth_passwd /dev/null
+proxy_auth_ignore
 DOC_END
 
 
index 8e2ec4dbc4b49dca68de9a34a7f4bdabc914a2ca..0771082f44707e234ee2ba646ebaa13caafbe045 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cf_gen.cc,v 1.2 1997/06/26 23:02:15 wessels Exp $
+ * $Id: cf_gen.cc,v 1.3 1997/07/06 05:14:10 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Max Okumoto
@@ -79,6 +79,7 @@ static const char WS[] = " \t";
 static void gen_default(Entry *, FILE *);
 static void gen_parse(Entry *, FILE *);
 static void gen_dump(Entry *, FILE *);
+static void gen_free(Entry *, FILE *);
 static void gen_conf(Entry *, FILE *);
 
 int
@@ -243,6 +244,7 @@ main(int argc, char *argv[])
      * Generate default_all()
      * Generate parse_line()
      * Generate dump_all()
+     * Generate free_all()
      * Generate example squid.conf file
      *-------------------------------------------------------------------*/
 
@@ -264,6 +266,7 @@ main(int argc, char *argv[])
     gen_default(entries, fp);
     gen_parse(entries, fp);
     gen_dump(entries, fp);
+    gen_free(entries, fp);
     fclose(fp);
 
     /* Open output x.conf file */
@@ -366,13 +369,11 @@ static void
 gen_dump(Entry * head, FILE * fp)
 {
     Entry *entry;
-
     fprintf(fp,
        "void\n"
        "dump_all(void)\n"
        "{\n"
        );
-
     for (entry = head; entry != NULL; entry = entry->next) {
        if (entry->loc == NULL) {
            fprintf(fp, "\tprintf(\"%s = \");\n", entry->type);
@@ -387,6 +388,25 @@ gen_dump(Entry * head, FILE * fp)
     fprintf(fp, "}\n\n");
 }
 
+static void
+gen_free(Entry * head, FILE * fp)
+{
+    Entry *entry;
+    fprintf(fp,
+       "void\n"
+       "free_all(void)\n"
+       "{\n"
+       );
+    for (entry = head; entry != NULL; entry = entry->next) {
+       if (entry->loc == NULL) {
+           fprintf(fp, "\tfree_%s();\n", entry->type);
+       } else {
+           fprintf(fp, "\tfree_%s(&%s);\n", entry->type, entry->loc);
+       }
+    }
+    fprintf(fp, "}\n\n");
+}
+
 static void
 gen_conf(Entry * head, FILE * fp)
 {