From: Jeremy Harris Date: Tue, 9 Jul 2019 21:43:18 +0000 (+0100) Subject: Expansions: acl expansion error detail X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/17ccbda62e05f6ed59a27791643be4b94f7fcdbd Expansions: acl expansion error detail --- diff --git a/src/src/expand.c b/src/src/expand.c index 74267ab0c..b3be83a46 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -2517,8 +2517,9 @@ switch(cond_type) if (yield != NULL) { + int rc; *resetok = FALSE; /* eval_acl() might allocate; do not reclaim */ - switch(eval_acl(sub, nelem(sub), &user_msg)) + switch(rc = eval_acl(sub, nelem(sub), &user_msg)) { case OK: cond = TRUE; @@ -2533,7 +2534,8 @@ switch(cond_type) f.expand_string_forcedfail = TRUE; /*FALLTHROUGH*/ default: - expand_string_message = string_sprintf("error from acl \"%s\"", sub[0]); + expand_string_message = string_sprintf("%s from acl \"%s\"", + rc_names[rc], sub[0]); return NULL; } } @@ -4250,6 +4252,7 @@ while (*s != 0) { uschar *sub[10]; /* name + arg1-arg9 (which must match number of acl_arg[]) */ uschar *user_msg; + int rc; switch(read_subs(sub, nelem(sub), 1, &s, skipping, TRUE, US"acl", &resetok)) @@ -4261,7 +4264,7 @@ while (*s != 0) if (skipping) continue; resetok = FALSE; - switch(eval_acl(sub, nelem(sub), &user_msg)) + switch(rc = eval_acl(sub, nelem(sub), &user_msg)) { case OK: case FAIL: @@ -4275,7 +4278,8 @@ while (*s != 0) f.expand_string_forcedfail = TRUE; /*FALLTHROUGH*/ default: - expand_string_message = string_sprintf("error from acl \"%s\"", sub[0]); + expand_string_message = string_sprintf("%s from acl \"%s\"", + rc_names[rc], sub[0]); goto EXPAND_FAILED; } } diff --git a/src/src/globals.h b/src/src/globals.h index 18aaad918..80e1764a3 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -801,6 +801,7 @@ extern uschar *raw_active_hostname; /* Pre-expansion */ extern uschar *raw_sender; /* Before rewriting */ extern uschar **raw_recipients; /* Before rewriting */ extern int raw_recipients_count; +extern const uschar * rc_names[]; /* Mostly for debug output */ extern int rcpt_count; /* Count of RCPT commands in a message */ extern int rcpt_fail_count; /* Those that got 5xx */ extern int rcpt_defer_count; /* Those that got 4xx */ diff --git a/test/log/5700 b/test/log/5700 index fc139b29a..7f810e438 100644 --- a/test/log/5700 +++ b/test/log/5700 @@ -25,7 +25,7 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 . [127.0.0.1] -> [127.0.0.1]:PORT_S 1999-03-02 09:44:33 10HmaX-0005vi-00 => userx@expansionfail R=others T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK" 1999-03-02 09:44:33 10HmaX-0005vi-00 event msg:delivery -1999-03-02 09:44:33 10HmaX-0005vi-00 failed to expand event_action msg:delivery in smtp: error from acl "logger" +1999-03-02 09:44:33 10HmaX-0005vi-00 failed to expand event_action msg:delivery in smtp: ERROR from acl "logger" 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed 1999-03-02 09:44:33 10HmaX-0005vi-00 event msg:complete diff --git a/test/paniclog/5700 b/test/paniclog/5700 index 4ed4279a2..224bda7d8 100644 --- a/test/paniclog/5700 +++ b/test/paniclog/5700 @@ -1,2 +1,2 @@ -1999-03-02 09:44:33 10HmaX-0005vi-00 failed to expand event_action msg:delivery in smtp: error from acl "logger" +1999-03-02 09:44:33 10HmaX-0005vi-00 failed to expand event_action msg:delivery in smtp: ERROR from acl "logger" diff --git a/test/stderr/5700 b/test/stderr/5700 index 4ed4279a2..224bda7d8 100644 --- a/test/stderr/5700 +++ b/test/stderr/5700 @@ -1,2 +1,2 @@ -1999-03-02 09:44:33 10HmaX-0005vi-00 failed to expand event_action msg:delivery in smtp: error from acl "logger" +1999-03-02 09:44:33 10HmaX-0005vi-00 failed to expand event_action msg:delivery in smtp: ERROR from acl "logger" diff --git a/test/stdout/0002 b/test/stdout/0002 index c9337869d..c1f9d3799 100644 --- a/test/stdout/0002 +++ b/test/stdout/0002 @@ -138,7 +138,7 @@ > > Failed: Not enough arguments for 'acl' (min is 1) > Failed: Not enough arguments for 'acl' (min is 1) -> Failed: error from acl "a_nosuch" +> Failed: ERROR from acl "a_nosuch" > acl: (0) [] [] > acl: (1) [person@dom.ain] [] > acl: (2) [firstarg] [secondarg] @@ -147,7 +147,7 @@ > acl: > acl: (0) [] [] > acl: (1) [person@dom.ain] [] -> Failed: error from acl "a_defer" +> Failed: DEFER from acl "a_defer" > acl: (2) [new arg1] [top_arg_1] > acl: (1) [1] [] (1) [2] [] (1) [3] [] (1) [4] [] > @@ -469,7 +469,7 @@ newline tab\134backslash ~tilde\177DEL\200\201. > acl if: Y:(0) [] [] > acl if: Y:(1) [argY] [] > acl if: N:(2) [argN] [arg2] -> Failed: error from acl "a_defer" +> Failed: DEFER from acl "a_defer" > > # Default values for both if strings >