From a4034eb84d56cfa1e8525bcf8b2f5af74e916ace Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 10 Oct 2016 14:20:30 +0100 Subject: [PATCH] Fix check for commandline macro definition Without this, mailq (done by unpriv user) and daemon SIGHUP handling fail Broken-by: c0b9d3e87264 --- src/src/exim.c | 8 ++++---- src/src/readconf.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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; -- 2.30.2