]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
ext_time_quota_acl: remove -l option (#1872)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Tue, 6 Aug 2024 17:44:00 +0000 (17:44 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 6 Aug 2024 17:44:09 +0000 (17:44 +0000)
Supporting logging to a file complicates upgrading helper code to use
debugs() because DebugFile code calls commSetCloseOnExec(), and our
comm/libminimal does not currently provide a functioning implementation
for that API: The existing implementation is an unconditional assert.
To save development time while upgrading helpers, we are dropping this
feature. It can probably be emulated using shell redirection tricks.

doc/release-notes/release-7.sgml.in
src/acl/external/time_quota/ext_time_quota_acl.8
src/acl/external/time_quota/ext_time_quota_acl.cc

index 35fc35d9586712653e757cd284a6e9f5f9a82c7b..e3150e65ffefd8ec7c5fb2076ff1000e0033ad63 100644 (file)
@@ -286,6 +286,15 @@ This section gives an account of those changes in three categories:
 
 </descrip>
 
+<sect1>Other changes<label id="otherchanges">
+<p>
+<descrip>
+       <tag>Adjusted configuration and format of ext_time_quota_acl helper debugging</tag>
+       <p>The <em>-l</em> option that enables <em>ext_time_quota_acl</em> to log debug messages
+               to a custom logfile has been removed, and their format has been
+               changed to be in line with Squid's cache.log format.
+</descrip>
+
 <sect>Copyright
 <p>
 Copyright (C) 1996-2023 The Squid Software Foundation and contributors
index 4abf99890e342676a63a209669cfdd999d5c0afb..579e0af17d7c801f65b08ae8f98fe0966f31f0c9 100644 (file)
@@ -7,7 +7,7 @@ Version 1.0
 .
 .SH SYNOPSIS
 .if !'po4a'hide' .B ext_time_quota_acl
-.if !'po4a'hide' .B "[\-b database] [\-l logfile] [\-d] [\-p pauselen] [\-h] configfile
+.if !'po4a'hide' .B "[\-b database] [\-d] [\-p pauselen] [\-h] configfile
 .
 .SH DESCRIPTION
 .B ext_time_quota_acl
@@ -35,14 +35,8 @@ Pauses shorter than this value will be counted against the quota, longer ones ig
 Default is 300 seconds (5 minutes).
 .
 .if !'po4a'hide' .TP
-.if !'po4a'hide' .B "\-l logfile"
-.B Filename
-where all logging and debugging information will be written. If none is given,
-then stderr will be used and the logging will go to Squids main cache.log.
-.
-.if !'po4a'hide' .TP
 .if !'po4a'hide' .B "\-d"
-Enables debug logging in the logfile.
+Enables debug logging to stderr.
 .
 .if !'po4a'hide' .TP
 .if !'po4a'hide' .B "\-h"
index 38fc70a923f01ceffe00c156a472cfff8d5d665c..5158e8f4584f8b7cd2989cd86376359bfd814457 100644 (file)
@@ -76,15 +76,6 @@ static int pauseLength = 300;
 static FILE *logfile = stderr;
 static int tq_debug_enabled = false;
 
-static void open_log(const char *logfilename)
-{
-    logfile = fopen(logfilename, "a");
-    if ( logfile == NULL ) {
-        perror(logfilename);
-        logfile = stderr;
-    }
-}
-
 static void vlog(const char *level, const char *format, va_list args)
 {
     time_t now = time(NULL);
@@ -397,11 +388,8 @@ static void processActivity(const char *user_key)
 
 static void usage(void)
 {
-    log_error("Wrong usage. Please reconfigure in squid.conf.\n");
-
-    fprintf(stderr, "Usage: %s [-d] [-l logfile] [-b dbpath] [-p pauselen] [-h] configfile\n", program_name);
-    fprintf(stderr, "  -d            enable debugging output to logfile\n");
-    fprintf(stderr, "  -l logfile    log messages to logfile\n");
+    fprintf(stderr, "Usage: %s [-d] [-b dbpath] [-p pauselen] [-h] configfile\n", program_name);
+    fprintf(stderr, "  -d            enable debugging output\n");
     fprintf(stderr, "  -b dbpath     Path where persistent session database will be kept\n");
     fprintf(stderr, "                If option is not used, then " DEFAULT_QUOTA_DB " will be used.\n");
     fprintf(stderr, "  -p pauselen   length in seconds to describe a pause between 2 requests.\n");
@@ -416,14 +404,11 @@ int main(int argc, char **argv)
 
     program_name = argv[0];
 
-    while ((opt = getopt(argc, argv, "dp:l:b:h")) != -1) {
+    while ((opt = getopt(argc, argv, "dp:b:h")) != -1) {
         switch (opt) {
         case 'd':
             tq_debug_enabled = true;
             break;
-        case 'l':
-            open_log(optarg);
-            break;
         case 'b':
             db_path = optarg;
             break;
@@ -434,6 +419,11 @@ int main(int argc, char **argv)
             usage();
             exit(EXIT_SUCCESS);
             break;
+        default:
+            // getopt() emits error message to stderr
+            usage();
+            exit(EXIT_FAILURE);
+            break;
         }
     }