From: Jeremy Harris Date: Tue, 25 Jan 2022 19:46:22 +0000 (+0000) Subject: Stop option for ACL control of debug logging X-Git-Tag: exim-4.96-RC0~89 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/9f691660159a9279353a99fca776c7687faaae26 Stop option for ACL control of debug logging --- diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 36ed7ca09..67d79aa7a 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -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 diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 77009ec33..46e6254bb 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -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 ------------ diff --git a/src/src/acl.c b/src/src/acl.c index c55a42b6f..19c1bbbd9 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -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; diff --git a/src/src/functions.h b/src/src/functions.h index 39dfc46fe..2a1142b35 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -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); diff --git a/src/src/log.c b/src/src/log.c index 2c82ee0a4..fe9bd0c9f 100644 --- a/src/src/log.c +++ b/src/src/log.c @@ -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. */