Stop option for ACL control of debug logging
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 25 Jan 2022 19:46:22 +0000 (19:46 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Thu, 27 Jan 2022 13:12:36 +0000 (13:12 +0000)
doc/doc-docbook/spec.xfpt
doc/doc-txt/NewStuff
src/src/acl.c
src/src/functions.h
src/src/log.c

index 36ed7ca092f0b8074fba1f652c4bdfacf6614002..67d79aa7abe49483b529d7351a55b816e5140ec8 100644 (file)
@@ -31604,8 +31604,10 @@ The filename can be adjusted with the &'tag'& option, which
 may access any variables already defined.  The logging may be adjusted with
 the &'opts'& option, which takes the same values as the &`-d`& command-line
 option.
-Logging started this way may be stopped, and the file removed,
-with the &'kill'& option.
+.new
+Logging started this way may be stopped by using the &'stop'& option.
+The &'kill'& option additionally removes the debug file.
+.wen
 Some examples (which depend on variables that don't exist in all
 contexts):
 .code
index 77009ec33993e639705f42a32984fed7effcf74e..46e6254bb862db2e19d98c33bf1b2b9c7aec0ec0 100644 (file)
@@ -17,6 +17,13 @@ Version 4.96
 
  4. An event for failing TLS connects to the daemon.
 
+ 5. Tainted data used for a query-style lookup should be quoted using the
+    expansion item for the lookup type.  If not, a warning will be written to
+    the main and panic logs.  A future release will enforce this by failing
+    the lookup.
+
+ 6. The ACL "debug" control gains a "stop" option.
+
 
 Version 4.95
 ------------
index c55a42b6f0971f218d9bfa45df8c7971a1d5ea5d..19c1bbbd9ac0dea99be006483592737699fc2929 100644 (file)
@@ -3481,7 +3481,7 @@ for (; cb; cb = cb->next)
          {
          uschar * debug_tag = NULL;
          uschar * debug_opts = NULL;
-         BOOL kill = FALSE;
+         BOOL kill = FALSE, stop = FALSE;
 
          while (*p == '/')
            {
@@ -3501,13 +3501,20 @@ for (; cb; cb = cb->next)
              for (pp += 4; *pp && *pp != '/';) pp++;
              kill = TRUE;
              }
+           else if (Ustrncmp(pp, "stop", 4) == 0)
+             {
+             for (pp += 4; *pp && *pp != '/';) pp++;
+             stop = TRUE;
+             }
            else
              while (*pp && *pp != '/') pp++;
            p = pp;
            }
 
            if (kill)
-             debug_logging_stop();
+             debug_logging_stop(TRUE);
+           else if (stop)
+             debug_logging_stop(FALSE);
            else
              debug_logging_activate(debug_tag, debug_opts);
          break;
index 39dfc46fe696fc7c8d87bf7d7403c49921b89c13..2a1142b358f3ef19b613765321fda0dee12495b0 100644 (file)
@@ -186,7 +186,7 @@ extern int     dcc_process(uschar **);
 #endif
 
 extern void    debug_logging_activate(uschar *, uschar *);
-extern void    debug_logging_stop(void);
+extern void    debug_logging_stop(BOOL);
 extern void    debug_print_argv(const uschar **);
 extern void    debug_print_ids(uschar *);
 extern void    debug_printf_indent(const char *, ...) PRINTF_FUNCTION(1,2);
index 2c82ee0a460a19c6d09b49c44a8f3e264b817a49..fe9bd0c9f2700516b592d16ef339e3ca381bb82a 100644 (file)
@@ -1510,14 +1510,14 @@ else
 
 
 void
-debug_logging_stop(void)
+debug_logging_stop(BOOL kill)
 {
 if (!debug_file || !debuglog_name[0]) return;
 
 debug_selector = 0;
 fclose(debug_file);
 debug_file = NULL;
-unlink_log(lt_debug);
+if (kill) unlink_log(lt_debug);
 }
 
 /* Called from the appendfile transport setup. */