From: Jeremy Harris Date: Mon, 10 Oct 2016 13:20:30 +0000 (+0100) Subject: Fix check for commandline macro definition X-Git-Tag: exim-4_88_RC3~39 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/a4034eb84d56cfa1e8525bcf8b2f5af74e916ace Fix check for commandline macro definition Without this, mailq (done by unpriv user) and daemon SIGHUP handling fail Broken-by: c0b9d3e87264 --- diff --git a/src/src/exim.c b/src/src/exim.c index f05ba78a8..95f8cef3b 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -1347,12 +1347,12 @@ exit(EXIT_FAILURE); /* Typically, Exim will drop privileges if macros are supplied. In some cases, we want to not do so. -Arguments: none (macros is a global) +Arguments: opt_D_used - true if the commandline had a "-D" option Returns: true if trusted, false otherwise */ static BOOL -macros_trusted(void) +macros_trusted(BOOL opt_D_used) { #ifdef WHITELIST_D_MACROS macro_item *m; @@ -1362,7 +1362,7 @@ size_t len; BOOL prev_char_item, found; #endif -if (macros == NULL) +if (!opt_D_used) return TRUE; #ifndef WHITELIST_D_MACROS return FALSE; @@ -3679,7 +3679,7 @@ configuration file changes and macro definitions haven't happened. */ if (( /* EITHER */ (!trusted_config || /* Config changed, or */ - !macros_trusted()) && /* impermissible macros and */ + !macros_trusted(opt_D_used)) && /* impermissible macros and */ real_uid != root_uid && /* Not root, and */ !running_in_test_harness /* Not fudged */ ) || /* OR */ diff --git a/src/src/readconf.c b/src/src/readconf.c index 8425c0b37..edc09aa4e 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -784,7 +784,7 @@ for (;;) replacing all occurrences of the macro. */ macro_found = FALSE; - for (m = macros; m != NULL; m = m->next) + for (m = macros; m; m = m->next) { uschar *p, *pp; uschar *t = s;