ph10 2007/02/06 12:19:27 GMT
Modified files:
exim-doc/doc-txt ChangeLog NewStuff
exim-src/src acl.c globals.c globals.h verify.c
Added files:
exim-test/confs 0553
exim-test/log 0553
exim-test/scripts/0000-Basic 0553
exim-test/stderr 0553
Log:
Flush SMTP before callout (unless control=no_callout_flush).
Revision Changes Path
1.471 +3 -0 exim/exim-doc/doc-txt/ChangeLog
1.138 +6 -2 exim/exim-doc/doc-txt/NewStuff
1.72 +12 -2 exim/exim-src/src/acl.c
1.71 +1 -0 exim/exim-src/src/globals.c
1.51 +1 -0 exim/exim-src/src/globals.h
1.48 +8 -0 exim/exim-src/src/verify.c
1.1 +63 -0 exim/exim-test/confs/0553 (new)
1.1 +18 -0 exim/exim-test/log/0553 (new)
1.1 +22 -0 exim/exim-test/scripts/0000-Basic/0553 (new)
1.1 +2 -0 exim/exim-test/stderr/0553 (new)
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.470
retrieving revision 1.471
diff -u -r1.470 -r1.471
--- ChangeLog 6 Feb 2007 11:11:39 -0000 1.470
+++ ChangeLog 6 Feb 2007 12:19:27 -0000 1.471
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.470 2007/02/06 11:11:39 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.471 2007/02/06 12:19:27 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -76,6 +76,9 @@
PH/16 Add ${if forany and ${if forall.
PH/17 Added dsn_from option to vary the From: line in DSNs.
+
+PH/18 Flush SMTP output before performing a callout, unless control =
+ no_callout_flush is set.
Exim version 4.66
Index: NewStuff
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/NewStuff,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -r1.137 -r1.138
--- NewStuff 6 Feb 2007 11:11:39 -0000 1.137
+++ NewStuff 6 Feb 2007 12:19:27 -0000 1.138
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.137 2007/02/06 11:11:39 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.138 2007/02/06 12:19:27 ph10 Exp $
New Features in Exim
--------------------
@@ -233,8 +233,12 @@
time and date.
11. Exim has been modified so that it flushes SMTP output before implementing
- a delay in an ACL. This behaviour can be disabled by obeying control =
- no_delay_flush at some earlier point.
+ a delay in an ACL. It also flushes the output before performing a callout,
+ as this can take a substantial time. These behaviours can be disabled by
+ obeying control = no_delay_flush or control = no_callout_flush,
+ respectively, at some earlier stage of the connection. The effect of the
+ new default behaviour is to disable the PIPELINING optimization in these
+ situations, in order to avoid unexpected timeouts in clients.
12. There are two new expansion conditions that iterate over a list. They are
called forany and forall, and they are used like this:
Index: acl.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/acl.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- acl.c 6 Feb 2007 11:16:21 -0000 1.71
+++ acl.c 6 Feb 2007 12:19:27 -0000 1.72
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/acl.c,v 1.71 2007/02/06 11:16:21 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/acl.c,v 1.72 2007/02/06 12:19:27 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -188,7 +188,8 @@
CONTROL_FAKEREJECT,
CONTROL_NO_MULTILINE,
CONTROL_NO_PIPELINING,
- CONTROL_NO_DELAY_FLUSH
+ CONTROL_NO_DELAY_FLUSH,
+ CONTROL_NO_CALLOUT_FLUSH
};
/* ACL control names; keep in step with the table above! This list is used for
@@ -220,7 +221,8 @@
US"fakereject",
US"no_multiline",
US"no_pipelining",
- US"no_delay_flush"
+ US"no_delay_flush",
+ US"no_callout_flush"
};
/* Flags to indicate for which conditions/modifiers a string expansion is done
@@ -598,6 +600,9 @@
(1<<ACL_WHERE_NOTSMTP_START),
(1<<ACL_WHERE_NOTSMTP)| /* no_delay_flush */
+ (1<<ACL_WHERE_NOTSMTP_START),
+
+ (1<<ACL_WHERE_NOTSMTP)| /* no_callout_flush */
(1<<ACL_WHERE_NOTSMTP_START)
};
@@ -621,6 +626,7 @@
{ US"caselower_local_part", CONTROL_CASELOWER_LOCAL_PART, FALSE },
{ US"enforce_sync", CONTROL_ENFORCE_SYNC, FALSE },
{ US"freeze", CONTROL_FREEZE, TRUE },
+ { US"no_callout_flush", CONTROL_NO_CALLOUT_FLUSH, FALSE },
{ US"no_delay_flush", CONTROL_NO_DELAY_FLUSH, FALSE },
{ US"no_enforce_sync", CONTROL_NO_ENFORCE_SYNC, FALSE },
{ US"no_multiline_responses", CONTROL_NO_MULTILINE, FALSE },
@@ -2613,6 +2619,10 @@
case CONTROL_NO_DELAY_FLUSH:
disable_delay_flush = TRUE;
+ break;
+
+ case CONTROL_NO_CALLOUT_FLUSH:
+ disable_callout_flush = TRUE;
break;
case CONTROL_FAKEDEFER:
Index: globals.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/globals.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- globals.c 6 Feb 2007 11:11:40 -0000 1.70
+++ globals.c 6 Feb 2007 12:19:27 -0000 1.71
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/globals.c,v 1.70 2007/02/06 11:11:40 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/globals.c,v 1.71 2007/02/06 12:19:27 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -499,6 +499,7 @@
int demime_ok = 0;
uschar *demime_reason = NULL;
#endif
+BOOL disable_callout_flush = FALSE;
BOOL disable_delay_flush = FALSE;
#ifdef ENABLE_DISABLE_FSYNC
BOOL disable_fsync = FALSE;
Index: globals.h
===================================================================
RCS file: /home/cvs/exim/exim-src/src/globals.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- globals.h 6 Feb 2007 11:11:40 -0000 1.50
+++ globals.h 6 Feb 2007 12:19:27 -0000 1.51
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/globals.h,v 1.50 2007/02/06 11:11:40 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/globals.h,v 1.51 2007/02/06 12:19:27 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -278,6 +278,7 @@
extern int demime_ok; /* Nonzero if message has been demimed */
extern uschar *demime_reason; /* Reason for broken MIME container */
#endif
+extern BOOL disable_callout_flush; /* Don't flush before callouts */
extern BOOL disable_delay_flush; /* Don't flush before "delay" in ACL */
#ifdef ENABLE_DISABLE_FSYNC
extern BOOL disable_fsync; /* Not for normal use */
Index: verify.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/verify.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- verify.c 30 Jan 2007 15:10:59 -0000 1.47
+++ verify.c 6 Feb 2007 12:19:27 -0000 1.48
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/verify.c,v 1.47 2007/01/30 15:10:59 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/verify.c,v 1.48 2007/02/06 12:19:27 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -384,6 +384,14 @@
if (callout_overall < 0) callout_overall = 4 * callout;
if (callout_connect < 0) callout_connect = callout;
callout_start_time = time(NULL);
+
+/* Before doing a real callout, if this is an SMTP connection, flush the SMTP
+output because a callout might take some time. When PIPELINING is active and
+there are many recipients, the total time for doing lots of callouts can add up
+and cause the client to time out. So in this case we forgo the PIPELINING
+optimization. */
+
+if (smtp_out != NULL && !disable_callout_flush) mac_smtp_fflush();
/* Now make connections to the hosts and do real callouts. The list of hosts
is passed in as an argument. */
Index: 0553
====================================================================
# Exim test configuration 0553
DCF =
SERVER =
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/SERVER%slog
gecos_pattern = ""
gecos_name = CALLER_NAME
# ----- Main settings -----
acl_smtp_rcpt = check_recipient
queue_only
# ----- ACL -----
begin acl
check_recipient:
# Callouts accepted with a delay
accept senders = :
delay = 1s
# Non-callouts do the callout
accept verify = recipient/callout
DCF
# ----- Routers -----
begin routers
t1:
driver = manualroute
route_list = * 127.0.0.1 byname
self = send
transport = smtp
# ----- Transports -----
begin transports
smtp:
driver = smtp
port = PORT_D
command_timeout = 2s
# ----- Retry -----
begin retry
* * F,5d,10s
# End
Index: 0553
====================================================================
1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss
1999-03-02 09:44:33 Start queue run: pid=pppp -qf
1999-03-02 09:44:33 10HmaX-0005vi-00 == userx1@??? R=t1 T=smtp defer (dd): Connection timed out: SMTP timeout while connected to 127.0.0.1 [127.0.0.1] after RCPT TO:<userx1@???>
1999-03-02 09:44:33 10HmaX-0005vi-00 == userx2@??? R=t1 T=smtp defer (dd): Connection timed out: SMTP timeout while connected to 127.0.0.1 [127.0.0.1] after RCPT TO:<userx1@???>
1999-03-02 09:44:33 10HmaX-0005vi-00 == userx3@??? R=t1 T=smtp defer (dd): Connection timed out: SMTP timeout while connected to 127.0.0.1 [127.0.0.1] after RCPT TO:<userx1@???>
1999-03-02 09:44:33 End queue run: pid=pppp -qf
1999-03-02 09:44:33 Start queue run: pid=pppp -qf
1999-03-02 09:44:33 10HmaX-0005vi-00 => userx1@??? R=t1 T=smtp H=127.0.0.1 [127.0.0.1]
1999-03-02 09:44:33 10HmaX-0005vi-00 -> userx2@??? R=t1 T=smtp H=127.0.0.1 [127.0.0.1]
1999-03-02 09:44:33 10HmaX-0005vi-00 -> userx3@??? R=t1 T=smtp H=127.0.0.1 [127.0.0.1]
1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
1999-03-02 09:44:33 End queue run: pid=pppp -qf
******** SERVER ********
1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
1999-03-02 09:44:33 SMTP connection from localhost (myhost.test.ex) [127.0.0.1] lost while reading message data (header)
1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@??? H=localhost (myhost.test.ex) [127.0.0.1] P=esmtp S=sss id=E10HmaX-0005vi-00@???
Index: 0553
====================================================================
# callout autoflush
need_ipv4
#
# Put a message on the queue (queue_only is set)
exim userx1@??? userx2@??? userx3@???
****
# This daemon is "old-style", without the flush
exim -DSERVER=server -DDCF=control=no_callout_flush -bd -oX PORT_D
****
exim -qf
****
sleep 1
killdaemon
#
# This daemon should flush before delaying
exim -DSERVER=server -bd -oX PORT_D
****
exim -qf
****
sleep 1
killdaemon
no_msglog_check
Index: 0553
====================================================================
******** SERVER ********