summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2006-02-08 16:10:46 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2006-02-08 16:10:46 +0000
commit064a94c915ab9d962a876049ed864a56dc2c7af4 (patch)
treebfe823015d699d653670bbaaa51fdac6dba25dea
parentea49d0e16fbc6f56fc5b8519d266f88d09139187 (diff)
Don't add From: or Reply-To: to quota warning messages if they are
provided by quota_warn_message.
-rw-r--r--doc/doc-txt/ChangeLog6
-rw-r--r--doc/doc-txt/NewStuff8
-rw-r--r--src/src/deliver.c49
-rw-r--r--test/confs/00955
-rw-r--r--test/mail/0095.userx9
-rw-r--r--test/scripts/0000-Basic/009510
6 files changed, 72 insertions, 15 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index f8f046b68..dd11682f1 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.287 2006/02/08 14:28:51 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.288 2006/02/08 16:10:46 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -102,6 +102,10 @@ PH/17 If a delivery to a pipe, file, or autoreply was deferred, Exim was not
using the correct key (the original address) when searching the retry
rules in order to find which one to use for generating the retry hint.
+PH/18 If quota_warn_message contains a From: header, Exim now refrains from
+ adding the default one. Similarly, if it contains a Reply-To: header, the
+ errors_reply_to option, if set, is not used.
+
Exim version 4.60
diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff
index 2aab4af8d..83e44d836 100644
--- a/doc/doc-txt/NewStuff
+++ b/doc/doc-txt/NewStuff
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.80 2005/12/12 15:58:53 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.81 2006/02/08 16:10:46 ph10 Exp $
New Features in Exim
--------------------
@@ -20,7 +20,7 @@ PH/01 There is a new global option called disable_ipv6, which does exactly what
data, etc. are also ignored. If IP literals are enabled, the ipliteral
router declines to handle IPv6 literal addresses.
-PH/01 There are now 20 of each type of ACL variable by default (instead of 10).
+PH/02 There are now 20 of each type of ACL variable by default (instead of 10).
It is also possible to change the numbers by setting ACL_CVARS and/or
ACL_MVARS in Local/Makefile. Backward compatibility is maintained if you
upgrade to this release with existing messages containing ACL variable
@@ -28,6 +28,10 @@ PH/01 There are now 20 of each type of ACL variable by default (instead of 10).
(downgrading) will not be compatible; the values of ACL variables will be
lost.
+PH/03 If quota_warn_message contains a From: header, Exim now refrains from
+ adding the default one. Similarly, if it contains a Reply-To: header, the
+ errors_reply_to option, if set, is not used.
+
Version 4.60
------------
diff --git a/src/src/deliver.c b/src/src/deliver.c
index dbec42e0e..e1e3714cc 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/deliver.c,v 1.27 2006/02/08 14:28:51 ph10 Exp $ */
+/* $Cambridge: exim/src/src/deliver.c,v 1.28 2006/02/08 16:10:46 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1490,6 +1490,44 @@ return FALSE;
+/******************************************************
+* Check for a given header in a header string *
+******************************************************/
+
+/* This function is used when generating quota warnings. The configuration may
+specify any header lines it likes in quota_warn_message. If certain of them are
+missing, defaults are inserted, so we need to be able to test for the presence
+of a given header.
+
+Arguments:
+ hdr the required header name
+ hstring the header string
+
+Returns: TRUE the header is in the string
+ FALSE the header is not in the string
+*/
+
+static BOOL
+contains_header(uschar *hdr, uschar *hstring)
+{
+int len = Ustrlen(hdr);
+uschar *p = hstring;
+while (*p != 0)
+ {
+ if (strncmpic(p, hdr, len) == 0)
+ {
+ p += len;
+ while (*p == ' ' || *p == '\t') p++;
+ if (*p == ':') return TRUE;
+ }
+ while (*p != 0 && *p != '\n') p++;
+ if (*p == '\n') p++;
+ }
+return FALSE;
+}
+
+
+
/*************************************************
* Perform a local delivery *
@@ -1991,12 +2029,13 @@ if (addr->special_action == SPECIAL_WARN &&
if (pid > 0)
{
FILE *f = fdopen(fd, "wb");
-
- if (errors_reply_to != NULL)
+ if (errors_reply_to != NULL &&
+ !contains_header(US"Reply-To", warn_message))
fprintf(f, "Reply-To: %s\n", errors_reply_to);
fprintf(f, "Auto-Submitted: auto-replied\n");
- fprintf(f, "From: Mail Delivery System <Mailer-Daemon@%s>\n",
- qualify_domain_sender);
+ if (!contains_header(US"From", warn_message))
+ fprintf(f, "From: Mail Delivery System <Mailer-Daemon@%s>\n",
+ qualify_domain_sender);
fprintf(f, "%s", CS warn_message);
/* Close and wait for child process to complete, without a timeout. */
diff --git a/test/confs/0095 b/test/confs/0095
index 1bd71acaa..c9494151d 100644
--- a/test/confs/0095
+++ b/test/confs/0095
@@ -1,5 +1,8 @@
# Exim test configuration 0095
+ERT=
+QWM=
+
exim_path = EXIM_PATH
host_lookup_order = bydns
primary_hostname = myhost.test.ex
@@ -11,6 +14,7 @@ gecos_name = CALLER_NAME
# ----- Main settings -----
+ERT
# ----- Routers -----
@@ -43,6 +47,7 @@ appendfile:
file = DIR/test-mail/$local_part
quota = $h_quota
quota_warn_threshold = $h_threshold
+ QWM
user = CALLER
appendfile2:
diff --git a/test/mail/0095.userx b/test/mail/0095.userx
index 5e720e10b..bd5e61c81 100644
--- a/test/mail/0095.userx
+++ b/test/mail/0095.userx
@@ -40,16 +40,14 @@ Received: from root by myhost.test.ex with local (Exim x.yz)
id 10HmbA-0005vi-00
for userx@myhost.test.ex; Tue, 2 Mar 1999 09:44:33 +0000
Auto-Submitted: auto-replied
-From: Mail Delivery System <Mailer-Daemon@myhost.test.ex>
+From : p@q
+Reply-To: a@b
To: userx@myhost.test.ex
Subject: Your mailbox
Message-Id: <E10HmbA-0005vi-00@myhost.test.ex>
Date: Tue, 2 Mar 1999 09:44:33 +0000
-This message is automatically created by mail delivery software (Exim).
-
-The size of your mailbox has exceeded a warning threshold that is
-set by the system administrator.
+Your mailbox has crossed the threshold
From CALLER@myhost.test.ex Tue Mar 02 09:44:33 1999
Received: from CALLER by myhost.test.ex with local (Exim x.yz)
@@ -68,6 +66,7 @@ From MAILER-DAEMON Tue Mar 02 09:44:33 1999
Received: from root by myhost.test.ex with local (Exim x.yz)
id 10HmbC-0005vi-00
for userx@myhost.test.ex; Tue, 2 Mar 1999 09:44:33 +0000
+Reply-To: x@y
Auto-Submitted: auto-replied
From: Mail Delivery System <Mailer-Daemon@myhost.test.ex>
To: userx@myhost.test.ex
diff --git a/test/scripts/0000-Basic/0095 b/test/scripts/0000-Basic/0095
index 45b6a7053..ba41247c0 100644
--- a/test/scripts/0000-Basic/0095
+++ b/test/scripts/0000-Basic/0095
@@ -7,12 +7,18 @@ quota: 0
threshold: 10
This is a test message
****
-exim -odi userx
+exim -DERT='errors_reply_to = x@y' \
+ -DQWM='quota_warn_message = From : p@q\n\
+ Reply-To: a@b\n\
+ To: $local_part@$domain\n\
+ Subject: Your mailbox\n\n\
+ Your mailbox has crossed the threshold\n' \
+ -odi userx
quota: 10K
threshold: 900
A test message
****
-exim -odi userx
+exim -DERT='errors_reply_to = x@y' -odi userx
quota: 2200
threshold: 90%
This is a test message