From 32b8ce41b3fe2ea10f3343a6c9e0acfccea40dd6 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Fri, 14 Apr 2017 14:29:40 +0100 Subject: [PATCH] Builtin macros: note config trigger line in debug output --- src/src/exim.c | 43 +++++++++++++++++-------------------------- src/src/globals.c | 3 ++- src/src/globals.h | 3 ++- src/src/readconf.c | 1 + 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/src/src/exim.c b/src/src/exim.c index 3dfe5db94..dcc84e3d5 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -3811,6 +3811,10 @@ defined) */ readconf_main(checking || list_options); +if (builtin_macros_create_trigger) DEBUG(D_any) + debug_printf("Builtin macros created (expensive) due to config line '%.*s'\n", + Ustrlen(builtin_macros_create_trigger)-1, builtin_macros_create_trigger); + /* Now in directory "/" */ if (cleanup_environment() == FALSE) @@ -3830,17 +3834,13 @@ if (real_uid == root_uid || real_uid == exim_uid || real_gid == exim_gid) else { int i, j; - for (i = 0; i < group_count; i++) - { - if (group_list[i] == exim_gid) admin_user = TRUE; - else if (admin_groups != NULL) - { - for (j = 1; j <= (int)(admin_groups[0]); j++) + for (i = 0; i < group_count && !admin_user; i++) + if (group_list[i] == exim_gid) + admin_user = TRUE; + else if (admin_groups) + for (j = 1; j <= (int)admin_groups[0] && !admin_user; j++) if (admin_groups[j] == group_list[i]) - { admin_user = TRUE; break; } - } - if (admin_user) break; - } + admin_user = TRUE; } /* Another group of privileged users are the trusted users. These are root, @@ -3854,27 +3854,18 @@ else { int i, j; - if (trusted_users != NULL) - { - for (i = 1; i <= (int)(trusted_users[0]); i++) + if (trusted_users) + for (i = 1; i <= (int)trusted_users[0] && !trusted_caller; i++) if (trusted_users[i] == real_uid) - { trusted_caller = TRUE; break; } - } + trusted_caller = TRUE; - if (!trusted_caller && trusted_groups != NULL) - { - for (i = 1; i <= (int)(trusted_groups[0]); i++) - { + if (trusted_groups) + for (i = 1; i <= (int)trusted_groups[0] && !trusted_caller; i++) if (trusted_groups[i] == real_gid) trusted_caller = TRUE; - else for (j = 0; j < group_count; j++) - { + else for (j = 0; j < group_count && !trusted_caller; j++) if (trusted_groups[i] == group_list[j]) - { trusted_caller = TRUE; break; } - } - if (trusted_caller) break; - } - } + trusted_caller = TRUE; } /* Handle the decoding of logging options. */ diff --git a/src/src/globals.c b/src/src/globals.c index 8dd3922cc..d61e894f3 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -470,6 +470,7 @@ int bmi_deliver = 1; int bmi_run = 0; uschar *bmi_verdicts = NULL; #endif +int bsmtp_transaction_linecount = 0; int body_8bitmime = 0; int body_linecount = 0; int body_zerocount = 0; @@ -481,7 +482,7 @@ int bounce_return_linesize_limit = 998; BOOL bounce_return_message = TRUE; int bounce_return_size_limit = 100*1024; uschar *bounce_sender_authentication = NULL; -int bsmtp_transaction_linecount = 0; +uschar *builtin_macros_create_trigger = NULL; uschar *callout_address = NULL; int callout_cache_domain_positive_expire = 7*24*60*60; diff --git a/src/src/globals.h b/src/src/globals.h index 5f9ad3bfe..1c58a936b 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -246,6 +246,7 @@ extern int bmi_deliver; /* Flag that determines if the message sh extern int bmi_run; /* Flag that determines if message should be run through Brightmail server */ extern uschar *bmi_verdicts; /* BASE64-encoded verdicts with recipient lists */ #endif +extern int bsmtp_transaction_linecount; /* Start of last transaction */ extern int body_8bitmime; /* sender declared BODY= ; 7=7BIT, 8=8BITMIME */ extern uschar *bounce_message_file; /* Template file */ extern uschar *bounce_message_text; /* One-liner */ @@ -255,7 +256,7 @@ extern int bounce_return_linesize_limit; /* Max line length in return */ extern BOOL bounce_return_message; /* Include message in bounce */ extern int bounce_return_size_limit; /* Max amount to return */ extern uschar *bounce_sender_authentication; /* AUTH address for bounces */ -extern int bsmtp_transaction_linecount; /* Start of last transaction */ +extern uschar *builtin_macros_create_trigger; /* config file line causing lazy-create */ extern uschar *callout_address; /* Address used for a malware/spamd/verify etc. callout */ extern int callout_cache_domain_positive_expire; /* Time for positive domain callout cache records to expire */ diff --git a/src/src/readconf.c b/src/src/readconf.c index e75ac41be..340a0c0eb 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -1026,6 +1026,7 @@ for (;;) if (c = p[1], c == 'O' || c == 'D' || c == 'H') { /* fprintf(stderr, "%s: builtins create triggered by '%s'\n", __FUNCTION__, s); */ + builtin_macros_create_trigger = string_copy(s); macros_create_builtin(); break; } -- 2.25.1