From c361138493e8f0f5d6f7d66d362737d92dba1269 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Wed, 14 Feb 2007 15:33:40 +0000 Subject: [PATCH] Add "continue" modifier. --- doc/doc-txt/ChangeLog | 5 ++++- doc/doc-txt/NewStuff | 14 ++++++++++++-- src/src/acl.c | 25 +++++++++++++++++-------- test/confs/0023 | 1 + test/stderr/0023 | 7 +++++++ 5 files changed, 41 insertions(+), 11 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 61b6ac275..1d894c339 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.479 2007/02/14 14:59:01 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.480 2007/02/14 15:33:40 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -106,6 +106,9 @@ PH/25 Applied Magnus Holmgren's patch for ${addresses, ${map, ${filter, and SC/02 Applied Daniel Tiefnig's patch to improve the '($parent) =' pattern match. +PH/26 Added a "continue" ACL modifier that does nothing, for the benefit of its + expansion side effects. + Exim version 4.66 ----------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index b70fa5e68..677ab21aa 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.141 2007/02/14 14:59:01 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.142 2007/02/14 15:33:40 ph10 Exp $ New Features in Exim -------------------- @@ -292,7 +292,7 @@ Version 4.67 option; with -I they don't. In both cases it is possible to change the case sensitivity within the pattern using (?i) or (?-i). -14. A number of new features have been added to string expansions to make it +16. A number of new features have been added to string expansions to make it easier to process lists of items, typically addresses. These are as follows: @@ -365,6 +365,16 @@ Version 4.67 At the end of a ${reduce expansion, the values of $item and $value is restored to what they were before. +17. There's a new ACL modifier called "continue". It does nothing of itself, + and processing of the ACL always continues with the next condition or + modifier. It is provided so that the side effects of expanding its argument + can be used. Typically this would be for updating a database. It is really + just a syntactic tidiness, because the following two lines have the same + effect: + + continue = + condition = ${if eq{0}{}{true}{true}} + Version 4.66 ------------ diff --git a/src/src/acl.c b/src/src/acl.c index 78b30addc..afbb93e5c 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/acl.c,v 1.73 2007/02/07 11:24:56 ph10 Exp $ */ +/* $Cambridge: exim/src/src/acl.c,v 1.74 2007/02/14 15:33:40 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -53,6 +53,7 @@ enum { ACLC_ACL, ACLC_BMI_OPTIN, #endif ACLC_CONDITION, + ACLC_CONTINUE, ACLC_CONTROL, #ifdef WITH_CONTENT_SCAN ACLC_DECODE, @@ -101,10 +102,10 @@ enum { ACLC_ACL, #endif ACLC_VERIFY }; -/* ACL conditions/modifiers: "delay", "control", "endpass", "message", -"log_message", "log_reject_target", "logwrite", and "set" are modifiers that -look like conditions but always return TRUE. They are used for their side -effects. */ +/* ACL conditions/modifiers: "delay", "control", "continue", "endpass", +"message", "log_message", "log_reject_target", "logwrite", and "set" are +modifiers that look like conditions but always return TRUE. They are used for +their side effects. */ static uschar *conditions[] = { US"acl", @@ -114,6 +115,7 @@ static uschar *conditions[] = { US"bmi_optin", #endif US"condition", + US"continue", US"control", #ifdef WITH_CONTENT_SCAN US"decode", @@ -237,6 +239,7 @@ static uschar cond_expand_at_top[] = { TRUE, /* bmi_optin */ #endif TRUE, /* condition */ + TRUE, /* continue */ TRUE, /* control */ #ifdef WITH_CONTENT_SCAN TRUE, /* decode */ @@ -296,6 +299,7 @@ static uschar cond_modifiers[] = { TRUE, /* bmi_optin */ #endif FALSE, /* condition */ + TRUE, /* continue */ TRUE, /* control */ #ifdef WITH_CONTENT_SCAN FALSE, /* decode */ @@ -345,9 +349,9 @@ static uschar cond_modifiers[] = { FALSE /* verify */ }; -/* Bit map vector of which conditions are not allowed at certain times. For -each condition, there's a bitmap of dis-allowed times. For some, it is easier -to specify the negation of a small number of allowed times. */ +/* Bit map vector of which conditions and modifiers are not allowed at certain +times. For each condition, there's a bitmap of dis-allowed times. For some, it +is easier to specify the negation of a small number of allowed times. */ static unsigned int cond_forbids[] = { 0, /* acl */ @@ -375,6 +379,8 @@ static unsigned int cond_forbids[] = { 0, /* condition */ + 0, /* continue */ + /* Certain types of control are always allowed, so we let it through always and check in the control processing itself. */ @@ -2554,6 +2560,9 @@ for (; cb != NULL; cb = cb->next) *log_msgptr = string_sprintf("invalid \"condition\" value \"%s\"", arg); break; + case ACLC_CONTINUE: /* Always succeeds */ + break; + case ACLC_CONTROL: control_type = decode_control(arg, &p, where, log_msgptr); diff --git a/test/confs/0023 b/test/confs/0023 index ac6d8f7e2..17c88ff6a 100644 --- a/test/confs/0023 +++ b/test/confs/0023 @@ -51,6 +51,7 @@ acl_1_2_3: deny message = domain explicitly denied log_message = DOMAIN EXPLICITLY DENIED + continue = this value is not used domains = deny.test.ex accept domains = +local_domains diff --git a/test/stderr/0023 b/test/stderr/0023 index d54ccab12..a0b6e2aed 100644 --- a/test/stderr/0023 +++ b/test/stderr/0023 @@ -16,6 +16,7 @@ >>> test.ex in "!wontpass"? yes (end of list) >>> require: condition test succeeded >>> processing "deny" +>>> check continue = this value is not used >>> check domains = deny.test.ex >>> test.ex in "deny.test.ex"? no (end of list) >>> deny: condition test failed @@ -36,6 +37,7 @@ >>> z in "!wontpass"? yes (end of list) >>> require: condition test succeeded >>> processing "deny" +>>> check continue = this value is not used >>> check domains = deny.test.ex >>> z in "deny.test.ex"? no (end of list) >>> deny: condition test failed @@ -65,6 +67,7 @@ LOG: H=[1.2.3.4] F= rejected RCPT >>> test.ex in "!wontpass"? yes (end of list) >>> require: condition test succeeded >>> processing "deny" +>>> check continue = this value is not used >>> check domains = deny.test.ex >>> test.ex in "deny.test.ex"? no (end of list) >>> deny: condition test failed @@ -85,6 +88,7 @@ LOG: H=[1.2.3.4] F= rejected RCPT >>> test.ex in "!wontpass"? yes (end of list) >>> require: condition test succeeded >>> processing "deny" +>>> check continue = this value is not used >>> check domains = deny.test.ex >>> test.ex in "deny.test.ex"? no (end of list) >>> deny: condition test failed @@ -105,6 +109,7 @@ LOG: H=[1.2.3.4] F= rejected RCPT >>> relay.test.ex in "!wontpass"? yes (end of list) >>> require: condition test succeeded >>> processing "deny" +>>> check continue = this value is not used >>> check domains = deny.test.ex >>> relay.test.ex in "deny.test.ex"? no (end of list) >>> deny: condition test failed @@ -125,6 +130,7 @@ LOG: H=[1.2.3.4] F= rejected RCPT >>> deny.test.ex in "!wontpass"? yes (end of list) >>> require: condition test succeeded >>> processing "deny" +>>> check continue = this value is not used >>> check domains = deny.test.ex >>> deny.test.ex in "deny.test.ex"? yes (matched "deny.test.ex") >>> deny: condition test succeeded @@ -139,6 +145,7 @@ LOG: H=[1.2.3.4] F= rejected RCPT : DOMAIN EXPLICITLY DENIE >>> refuse.test.ex in "!wontpass"? yes (end of list) >>> require: condition test succeeded >>> processing "deny" +>>> check continue = this value is not used >>> check domains = deny.test.ex >>> refuse.test.ex in "deny.test.ex"? no (end of list) >>> deny: condition test failed -- 2.30.2