ph10 2006/04/20 15:11:30 BST
Modified files:
exim-doc/doc-txt ChangeLog NewStuff
exim-src/src deliver.c
exim-src/src/transports appendfile.c
exim-test runtest
exim-test/log 0411
exim-test/mail 0411.afolder
exim-test/scripts/0000-Basic 0411
Added files:
exim-test/confs 0534
exim-test/log 0534
exim-test/mail 0534.mbox 0534.mbox2
exim-test/scripts/0000-Basic 0534
Log:
Make batch delivery work for files and pipes set up by redirection.
Revision Changes Path
1.344 +5 -0 exim/exim-doc/doc-txt/ChangeLog
1.101 +4 -0 exim/exim-doc/doc-txt/NewStuff
1.31 +17 -6 exim/exim-src/src/deliver.c
1.15 +8 -3 exim/exim-src/src/transports/appendfile.c
1.1 +50 -0 exim/exim-test/confs/0534 (new)
1.2 +1 -1 exim/exim-test/log/0411
1.1 +9 -0 exim/exim-test/log/0534 (new)
1.2 +0 -9 exim/exim-test/mail/0411.afolder
1.1 +12 -0 exim/exim-test/mail/0534.mbox (new)
1.1 +12 -0 exim/exim-test/mail/0534.mbox2 (new)
1.7 +1 -1 exim/exim-test/runtest
1.2 +1 -1 exim/exim-test/scripts/0000-Basic/0411
1.1 +10 -0 exim/exim-test/scripts/0000-Basic/0534 (new)
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.343
retrieving revision 1.344
diff -u -r1.343 -r1.344
--- ChangeLog 20 Apr 2006 10:57:46 -0000 1.343
+++ ChangeLog 20 Apr 2006 14:11:29 -0000 1.344
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.343 2006/04/20 10:57:46 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.344 2006/04/20 14:11:29 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -27,6 +27,11 @@
PH/04 Change PH/19 for 4.61 was too wide. It should not be applied to host
errors. Otherwise a message that provokes a temporary error (when other
messages do not) can cause a whole host to time out.
+
+PH/05 Batch deliveries by appendfile and pipe transports did not work when the
+ addresses were routed directly to files or pipes from a redirect router.
+ File deliveries just didn't batch; pipe deliveries might have suffered
+ odd errors.
Exim version 4.61
Index: NewStuff
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/NewStuff,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- NewStuff 18 Apr 2006 11:13:19 -0000 1.100
+++ NewStuff 20 Apr 2006 14:11:29 -0000 1.101
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.100 2006/04/18 11:13:19 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.101 2006/04/20 14:11:29 ph10 Exp $
New Features in Exim
--------------------
@@ -24,6 +24,10 @@
one IP address, they are each tried in turn until a connection is made. Once
a connection has been made, the behaviour is as for ${readsocket with a Unix
domain socket.
+
+2. If a redirect router sets up file or pipe deliveries for more than one
+ incoming address, and the relevant transport has batch_max set greater than
+ one, a batch delivery now occurs.
Version 4.61
Index: deliver.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/deliver.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- deliver.c 1 Mar 2006 16:07:16 -0000 1.30
+++ deliver.c 20 Apr 2006 14:11:29 -0000 1.31
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/deliver.c,v 1.30 2006/03/01 16:07:16 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/deliver.c,v 1.31 2006/04/20 14:11:29 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -228,11 +228,18 @@
}
/* For multiple addresses, don't set local part, and leave the domain and
-self_hostname set only if it is the same for all of them. */
+self_hostname set only if it is the same for all of them. It is possible to
+have multiple pipe and file addresses, but only when all addresses have routed
+to the same pipe or file. */
else
{
address_item *addr2;
+ if (testflag(addr, af_pfr))
+ {
+ if (testflag(addr, af_file)) address_file = addr->local_part;
+ else if (addr->local_part[0] == '|') address_pipe = addr->local_part;
+ }
for (addr2 = addr->next; addr2 != NULL; addr2 = addr2->next)
{
if (deliver_domain != NULL &&
@@ -2119,15 +2126,17 @@
disable_logging = tp->disable_logging;
- /* Check for batched addresses and possible amalgamation. File deliveries can
- never be batched. Skip all the work if either batch_max <= 1 or there aren't
- any other addresses for local delivery. */
+ /* Check for batched addresses and possible amalgamation. Skip all the work
+ if either batch_max <= 1 or there aren't any other addresses for local
+ delivery. */
- if (!testflag(addr, af_file) && tp->batch_max > 1 && addr_local != NULL)
+ if (tp->batch_max > 1 && addr_local != NULL)
{
int batch_count = 1;
BOOL uses_dom = readconf_depends((driver_instance *)tp, US"domain");
- BOOL uses_lp = readconf_depends((driver_instance *)tp, US"local_part");
+ BOOL uses_lp = (testflag(addr, af_pfr) &&
+ (testflag(addr, af_file) || addr->local_part[0] == '|')) ||
+ readconf_depends((driver_instance *)tp, US"local_part");
uschar *batch_id = NULL;
address_item **anchor = &addr_local;
address_item *last = addr;
@@ -2156,6 +2165,7 @@
same transport
not previously delivered (see comment about 50 lines above)
same local part if the transport's configuration contains $local_part
+ or if this is a file or pipe delivery from a redirection
same domain if the transport's configuration contains $domain
same errors address
same additional headers
@@ -2169,6 +2179,7 @@
BOOL ok =
tp == next->transport &&
!previously_transported(next, TRUE) &&
+ (addr->flags & (af_pfr|af_file)) == (next->flags & (af_pfr|af_file)) &&
(!uses_lp || Ustrcmp(next->local_part, addr->local_part) == 0) &&
(!uses_dom || Ustrcmp(next->domain, addr->domain) == 0) &&
same_strings(next->p.errors_address, addr->p.errors_address) &&
Index: appendfile.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/transports/appendfile.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- appendfile.c 1 Mar 2006 11:24:04 -0000 1.14
+++ appendfile.c 20 Apr 2006 14:11:29 -0000 1.15
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/transports/appendfile.c,v 1.14 2006/03/01 11:24:04 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/transports/appendfile.c,v 1.15 2006/04/20 14:11:29 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1333,10 +1333,15 @@
return FALSE;
}
-/* For a file delivery, make sure the local part in the address is updated to
-the true local part. */
+/* For a file delivery, make sure the local part in the address(es) is updated
+to the true local part. */
-if (testflag(addr, af_file)) addr->local_part = string_copy(path);
+if (testflag(addr, af_file))
+ {
+ address_item *addr2;
+ for (addr2 = addr; addr2 != NULL; addr2 = addr2->next)
+ addr2->local_part = string_copy(path);
+ }
/* The available mailbox formats depend on whether it is a directory or a file
delivery. */
Index: runtest
===================================================================
RCS file: /home/cvs/exim/exim-test/runtest,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- runtest 17 Mar 2006 16:51:45 -0000 1.6
+++ runtest 20 Apr 2006 14:11:29 -0000 1.7
@@ -1,6 +1,6 @@
#! /usr/bin/perl -w
-# $Cambridge: exim/exim-test/runtest,v 1.6 2006/03/17 16:51:45 ph10 Exp $
+# $Cambridge: exim/exim-test/runtest,v 1.7 2006/04/20 14:11:29 ph10 Exp $
###############################################################################
# This is the controlling script for the "new" test suite for Exim. It should #
@@ -23,7 +23,7 @@
# Start by initializing some global variables
-$testversion = "4.61 (06-Feb-06)";
+$testversion = "4.62 (20-Apr-06)";
$cf = "bin/cf";
$cr = "\r";
Index: 0534
====================================================================
# Exim test configuration 0534
exim_path = EXIM_PATH
host_lookup_order = bydns
primary_hostname = myhost.test.ex
rfc1413_query_timeout = 0s
spool_directory = DIR/spool
log_file_path = DIR/spool/log/%slog
gecos_pattern = ""
gecos_name = CALLER_NAME
# ----- Main settings -----
# ----- Routers -----
begin routers
r1:
driver = redirect
local_part_prefix = file-
local_part_suffix = =*
data = DIR/test-mail/${substr_1:$local_part_suffix}
file_transport = t1
r2:
driver = redirect
local_part_prefix = pipe-
local_part_suffix = =*
data = |${substr_1:$local_part_suffix}
pipe_transport = t2
# ----- Transports -----
begin transports
t1:
driver = appendfile
envelope_to_add
user = CALLER
batch_max = 10
t2:
driver = pipe
user = CALLER
batch_max = 10
# End
Index: 0534
====================================================================
1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaX-0005vi-00 => |TESTSUITE/bin/../bin/iefbr14 <pipe-userz=TESTSUITE/bin/../bin/iefbr14@???> R=r2 T=t2
1999-03-02 09:44:33 10HmaX-0005vi-00 => |TESTSUITE/bin/iefbr14 <pipe-usery=TESTSUITE/bin/iefbr14@???> R=r2 T=t2
1999-03-02 09:44:33 10HmaX-0005vi-00 -> |TESTSUITE/bin/iefbr14 <pipe-userx=TESTSUITE/bin/iefbr14@???> R=r2 T=t2
1999-03-02 09:44:33 10HmaX-0005vi-00 => TESTSUITE/test-mail/mbox2 <file-usera=mbox2@???> R=r1 T=t1
1999-03-02 09:44:33 10HmaX-0005vi-00 -> TESTSUITE/test-mail/mbox2 <file-userz=mbox2@???> R=r1 T=t1
1999-03-02 09:44:33 10HmaX-0005vi-00 => TESTSUITE/test-mail/mbox <file-usery=mbox@???> R=r1 T=t1
1999-03-02 09:44:33 10HmaX-0005vi-00 -> TESTSUITE/test-mail/mbox <file-userx=mbox@???> R=r1 T=t1
1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
Index: 0411
===================================================================
RCS file: /home/cvs/exim/exim-test/log/0411,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 0411 7 Feb 2006 10:34:46 -0000 1.1
+++ 0411 20 Apr 2006 14:11:29 -0000 1.2
@@ -3,7 +3,7 @@
1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaY-0005vi-00 => TESTSUITE/test-mail/afolder <t12@???> R=r1 T=t1
-1999-03-02 09:44:33 10HmaY-0005vi-00 => TESTSUITE/test-mail/afolder <t11@???> R=r1 T=t1
+1999-03-02 09:44:33 10HmaY-0005vi-00 -> TESTSUITE/test-mail/afolder <t11@???> R=r1 T=t1
1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaZ-0005vi-00 == save bfolder <t2@???> R=r2 T=t2 defer (-21): appendfile: file or directory name "bfolder" is not absolute
Index: 0534.mbox
====================================================================
From CALLER@??? Tue Mar 02 09:44:33 1999
Envelope-to: file-usery=mbox@???,
file-userx=mbox@???
Received: from CALLER by myhost.test.ex with local (Exim x.yz)
(envelope-from <CALLER@???>)
id 10HmaX-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000
Message-Id: <E10HmaX-0005vi-00@???>
From: CALLER_NAME <CALLER@???>
Date: Tue, 2 Mar 1999 09:44:33 +0000
A test message.
Index: 0534.mbox2
====================================================================
From CALLER@??? Tue Mar 02 09:44:33 1999
Envelope-to: file-usera=mbox2@???,
file-userz=mbox2@???
Received: from CALLER by myhost.test.ex with local (Exim x.yz)
(envelope-from <CALLER@???>)
id 10HmaX-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000
Message-Id: <E10HmaX-0005vi-00@???>
From: CALLER_NAME <CALLER@???>
Date: Tue, 2 Mar 1999 09:44:33 +0000
A test message.
Index: 0411.afolder
===================================================================
RCS file: /home/cvs/exim/exim-test/mail/0411.afolder,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 0411.afolder 7 Feb 2006 10:34:59 -0000 1.1
+++ 0411.afolder 20 Apr 2006 14:11:30 -0000 1.2
@@ -17,12 +17,3 @@
Date: Tue, 2 Mar 1999 09:44:33 +0000
-From CALLER@??? Tue Mar 02 09:44:33 1999
-Received: from CALLER by mail.test.ex with local (Exim x.yz)
- (envelope-from <CALLER@???>)
- id 10HmaY-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000
-Message-Id: <E10HmaY-0005vi-00@???>
-From: CALLER_NAME <CALLER@???>
-Date: Tue, 2 Mar 1999 09:44:33 +0000
-
-
Index: 0534
====================================================================
# Batch_max when redirecting to a mailbox or a pipe
exim -odi file-userx=mbox@??? \
file-usery=mbox@??? \
file-userz=mbox2@??? \
file-usera=mbox2@??? \
pipe-userx=DIR/bin/iefbr14@??? \
pipe-usery=DIR/bin/iefbr14@??? \
pipe-userz=DIR/bin/../bin/iefbr14@???
A test message.
****
Index: 0411
===================================================================
RCS file: /home/cvs/exim/exim-test/scripts/0000-Basic/0411,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 0411 7 Feb 2006 10:54:33 -0000 1.1
+++ 0411 20 Apr 2006 14:11:30 -0000 1.2
@@ -1,7 +1,7 @@
# use of file= in appendfile with filter setting the folder
exim -odi t1
****
-# Batched multiple deliveries (it doesn't batch)
+# Batched multiple deliveries (since 4.62 it does batch)
exim -odi t11 t12
****
# Error message for failure before full path is set