From 6a3f1455e3402f214d60abb87969660844770d91 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Mon, 13 Feb 2006 12:02:59 +0000 Subject: [PATCH] Add control=freeze/no_tell feature. --- doc/doc-txt/ChangeLog | 4 +++- doc/doc-txt/NewStuff | 8 +++++++- src/ACKNOWLEDGMENTS | 5 +++-- src/src/acl.c | 17 ++++++++++++++--- src/src/globals.c | 3 ++- src/src/globals.h | 3 ++- src/src/readconf.c | 7 ++++++- src/src/smtp_in.c | 3 ++- test/confs/0233 | 4 +++- test/log/0233 | 13 ++++++++++--- test/mail/0233.me | 20 +++++++++++++++++--- test/msglog/0233.10HmbB-0005vi-00 | 2 ++ test/msglog/0233.10HmbD-0005vi-00 | 2 ++ test/scripts/0000-Basic/0233 | 15 ++++++++++++++- test/stdout/0233 | 9 +++++++++ 15 files changed, 96 insertions(+), 19 deletions(-) create mode 100644 test/msglog/0233.10HmbB-0005vi-00 create mode 100644 test/msglog/0233.10HmbD-0005vi-00 diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 427f0b2a3..4aeffb78d 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.293 2006/02/13 11:28:56 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.294 2006/02/13 12:02:59 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -141,6 +141,8 @@ PH/25 Do not write to syslog when running in the test harness. The only occasion when this arises is a failure to open the main or panic logs (for which there is an explicit test). +PH/26 Added the /no_tell option to "control=freeze". + Exim version 4.60 diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 6dfb76ea8..0cc752e52 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.82 2006/02/10 14:25:43 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.83 2006/02/13 12:02:59 ph10 Exp $ New Features in Exim -------------------- @@ -40,6 +40,12 @@ PH/04 The variables $auth1, $auth2, $auth3 are now available in authenticators, the use of the numerical ones being deprecated, though the support will not be removed, at least, not for a long time. +PH/05 The "control=freeze" ACL modifier can now be followed by /no_tell. If + the global option freeze_tell is set, it is ignored for the current + message (that is, nobody is told about the freezing), provided all the + "control=freeze" modifiers that are obeyed in the current message have + the /no_tell option. + Version 4.60 ------------ diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS index 54b7da044..455b39fe5 100644 --- a/src/ACKNOWLEDGMENTS +++ b/src/ACKNOWLEDGMENTS @@ -1,4 +1,4 @@ -$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.39 2005/12/12 15:58:53 ph10 Exp $ +$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.40 2006/02/13 12:02:59 ph10 Exp $ EXIM ACKNOWLEDGEMENTS @@ -20,7 +20,7 @@ relatively small patches. Philip Hazel Lists created: 20 November 2002 -Last updated: 12 December 2005 +Last updated: 13 February 2006 THE OLD LIST @@ -243,5 +243,6 @@ Joachim Wieland Patches for PostgreSQL socket support and other Patch for hosts_avoid_esmtp Stephen Wilcox Patch for ignore_enotdir problem David Woodhouse SQLite support proof of concept code + control=freeze/no_tell basic code **** diff --git a/src/src/acl.c b/src/src/acl.c index f5949f04f..6efc313d1 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/acl.c,v 1.54 2006/02/07 11:19:00 ph10 Exp $ */ +/* $Cambridge: exim/src/src/acl.c,v 1.55 2006/02/13 12:02:59 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -528,7 +528,7 @@ static control_def controls_list[] = { { US"caseful_local_part", CONTROL_CASEFUL_LOCAL_PART, FALSE }, { US"caselower_local_part", CONTROL_CASELOWER_LOCAL_PART, FALSE }, { US"enforce_sync", CONTROL_ENFORCE_SYNC, FALSE }, - { US"freeze", CONTROL_FREEZE, FALSE }, + { US"freeze", CONTROL_FREEZE, TRUE }, { US"no_enforce_sync", CONTROL_NO_ENFORCE_SYNC, FALSE }, { US"no_multiline_responses", CONTROL_NO_MULTILINE, FALSE }, { US"queue_only", CONTROL_QUEUE_ONLY, FALSE }, @@ -2375,7 +2375,7 @@ for (; cb != NULL; cb = cb->next) { /* A nested ACL that returns "discard" makes sense only for an "accept" or "discard" verb. */ - +\ case ACLC_ACL: rc = acl_check_internal(where, addr, arg, level+1, user_msgptr, log_msgptr); if (rc == DISCARD && verb != ACL_ACCEPT && verb != ACL_DISCARD) @@ -2489,6 +2489,17 @@ for (; cb != NULL; cb = cb->next) case CONTROL_FREEZE: deliver_freeze = TRUE; deliver_frozen_at = time(NULL); + freeze_tell = freeze_tell_config; /* Reset to configured value */ + if (Ustrncmp(p, "/no_tell", 8) == 0) + { + p += 8; + freeze_tell = NULL; + } + if (*p != 0) + { + *log_msgptr = string_sprintf("syntax error in \"control=%s\"", arg); + return ERROR; + } break; case CONTROL_QUEUE_ONLY: diff --git a/src/src/globals.c b/src/src/globals.c index 275b7c8f0..11470fbe4 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.c,v 1.47 2006/02/10 16:29:20 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.c,v 1.48 2006/02/13 12:02:59 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -545,6 +545,7 @@ uschar *found_extension = NULL; #endif uid_t fixed_never_users[] = { FIXED_NEVER_USERS }; uschar *freeze_tell = NULL; +uschar *freeze_tell_config = NULL; uschar *fudged_queue_times = US""; uschar *gecos_name = NULL; diff --git a/src/src/globals.h b/src/src/globals.h index e3628167f..c884dfaf2 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.h,v 1.34 2006/02/10 14:25:43 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.h,v 1.35 2006/02/13 12:02:59 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -333,6 +333,7 @@ extern uid_t fixed_never_users[]; /* Can't be overridden */ extern uschar *found_extension; /* demime acl condition: file extension found */ #endif extern uschar *freeze_tell; /* Message on (some) freezings */ +extern uschar *freeze_tell_config; /* The configured setting */ extern uschar *fudged_queue_times; /* For use in test harness */ extern uschar *gecos_name; /* To be expanded when pattern matches */ diff --git a/src/src/readconf.c b/src/src/readconf.c index 5623b87f4..62b6d5b85 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/readconf.c,v 1.18 2006/02/08 14:28:51 ph10 Exp $ */ +/* $Cambridge: exim/src/src/readconf.c,v 1.19 2006/02/13 12:02:59 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -2819,6 +2819,11 @@ if (timezone_string != NULL && *timezone_string == 0) timezone_string = NULL; if (remote_max_parallel <= 0) remote_max_parallel = 1; +/* Save the configured setting of freeze_tell, so we can re-instate it at the +start of a new SMTP message. */ + +freeze_tell_config = freeze_tell; + /* The primary host name may be required for expansion of spool_directory and log_file_path, so make sure it is set asap. It is obtained from uname(), but if that yields an unqualified value, make a FQDN by using gethostbyname to diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 04bffd017..cc6486a40 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/smtp_in.c,v 1.30 2006/02/10 14:25:43 ph10 Exp $ */ +/* $Cambridge: exim/src/src/smtp_in.c,v 1.31 2006/02/13 12:02:59 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -806,6 +806,7 @@ message_size = -1; acl_warn_headers = NULL; queue_only_policy = FALSE; deliver_freeze = FALSE; /* Can be set by ACL */ +freeze_tell = freeze_tell_config; /* Can be set by ACL */ fake_response = OK; /* Can be set by ACL */ #ifdef WITH_CONTENT_SCAN no_mbox_unspool = FALSE; /* Can be set by ACL */ diff --git a/test/confs/0233 b/test/confs/0233 index cbd87c4b7..15c605c24 100644 --- a/test/confs/0233 +++ b/test/confs/0233 @@ -23,7 +23,9 @@ system_filter_reply_transport = address_reply begin acl rcpt: - accept control = freeze + accept local_parts = usery + control = freeze + accept control = freeze/no_tell # ----- Routers ----- diff --git a/test/log/0233 b/test/log/0233 index ac592afee..dd3861f85 100644 --- a/test/log/0233 +++ b/test/log/0233 @@ -9,6 +9,13 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 Frozen by the system filter: system filter freezes 1999-03-02 09:44:33 10HmbA-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-smtp S=sss 1999-03-02 09:44:33 10HmbA-0005vi-00 frozen by ACL -1999-03-02 09:44:33 10HmbB-0005vi-00 <= <> R=10HmbA-0005vi-00 U=EXIMUSER P=local S=sss -1999-03-02 09:44:33 10HmbB-0005vi-00 => me R=all T=local_delivery -1999-03-02 09:44:33 10HmbB-0005vi-00 Completed +1999-03-02 09:44:33 10HmbB-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-smtp S=sss +1999-03-02 09:44:33 10HmbB-0005vi-00 frozen by ACL +1999-03-02 09:44:33 10HmbC-0005vi-00 <= <> R=10HmbB-0005vi-00 U=EXIMUSER P=local S=sss +1999-03-02 09:44:33 10HmbC-0005vi-00 => me R=all T=local_delivery +1999-03-02 09:44:33 10HmbC-0005vi-00 Completed +1999-03-02 09:44:33 10HmbD-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-smtp S=sss +1999-03-02 09:44:33 10HmbD-0005vi-00 frozen by ACL +1999-03-02 09:44:33 10HmbE-0005vi-00 <= <> R=10HmbD-0005vi-00 U=EXIMUSER P=local S=sss +1999-03-02 09:44:33 10HmbE-0005vi-00 => me R=all T=local_delivery +1999-03-02 09:44:33 10HmbE-0005vi-00 Completed diff --git a/test/mail/0233.me b/test/mail/0233.me index e8e8c8f33..1e9b1086c 100644 --- a/test/mail/0233.me +++ b/test/mail/0233.me @@ -18,15 +18,29 @@ The following address(es) have yet to be delivered: From MAILER-DAEMON Tue Mar 02 09:44:33 1999 Received: from EXIMUSER by myhost.test.ex with local (Exim x.yz) - id 10HmbB-0005vi-00 + id 10HmbC-0005vi-00 for me@myhost.test.ex; Tue, 2 Mar 1999 09:44:33 +0000 Auto-Submitted: auto-replied From: Mail Delivery System To: me@myhost.test.ex Subject: Message frozen on arrival -Message-Id: +Message-Id: Date: Tue, 2 Mar 1999 09:44:33 +0000 -Message 10HmbA-0005vi-00 was frozen on arrival by ACL. +Message 10HmbB-0005vi-00 was frozen on arrival by ACL. +The sender is . + +From MAILER-DAEMON Tue Mar 02 09:44:33 1999 +Received: from EXIMUSER by myhost.test.ex with local (Exim x.yz) + id 10HmbE-0005vi-00 + for me@myhost.test.ex; Tue, 2 Mar 1999 09:44:33 +0000 +Auto-Submitted: auto-replied +From: Mail Delivery System +To: me@myhost.test.ex +Subject: Message frozen on arrival +Message-Id: +Date: Tue, 2 Mar 1999 09:44:33 +0000 + +Message 10HmbD-0005vi-00 was frozen on arrival by ACL. The sender is . diff --git a/test/msglog/0233.10HmbB-0005vi-00 b/test/msglog/0233.10HmbB-0005vi-00 new file mode 100644 index 000000000..0840c1df2 --- /dev/null +++ b/test/msglog/0233.10HmbB-0005vi-00 @@ -0,0 +1,2 @@ +1999-03-02 09:44:33 Received from CALLER@myhost.test.ex U=CALLER P=local-smtp S=sss +1999-03-02 09:44:33 frozen by ACL diff --git a/test/msglog/0233.10HmbD-0005vi-00 b/test/msglog/0233.10HmbD-0005vi-00 new file mode 100644 index 000000000..0840c1df2 --- /dev/null +++ b/test/msglog/0233.10HmbD-0005vi-00 @@ -0,0 +1,2 @@ +1999-03-02 09:44:33 Received from CALLER@myhost.test.ex U=CALLER P=local-smtp S=sss +1999-03-02 09:44:33 frozen by ACL diff --git a/test/scripts/0000-Basic/0233 b/test/scripts/0000-Basic/0233 index 0acb13fca..13726815c 100644 --- a/test/scripts/0000-Basic/0233 +++ b/test/scripts/0000-Basic/0233 @@ -1,12 +1,25 @@ # freeze_tell & system filter & ACL +# System filter freezes this one exim -odi userx Rhubarb **** +# ACL freezes these two, tell for the second, and third, not for the first exim -odi -bs mail from: +rcpt to: +data +Should be frozen (no tell) +. +mail from: +rcpt to: +data +Should be frozen (with tell) +. +mail from: +rcpt to: rcpt to: data -Should be frozen +Should be frozen (with tell because not both no_tell) . quit **** diff --git a/test/stdout/0233 b/test/stdout/0233 index 773412dc5..0644977a2 100644 --- a/test/stdout/0233 +++ b/test/stdout/0233 @@ -3,4 +3,13 @@ 250 Accepted 354 Enter message, ending with "." on a line by itself 250 OK id=10HmbA-0005vi-00 +250 OK +250 Accepted +354 Enter message, ending with "." on a line by itself +250 OK id=10HmbB-0005vi-00 +250 OK +250 Accepted +250 Accepted +354 Enter message, ending with "." on a line by itself +250 OK id=10HmbD-0005vi-00 221 myhost.test.ex closing connection -- 2.30.2