From c51b8e75b2fe31282ea1526ed556d7d9402d543f Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Tue, 6 Feb 2007 14:49:13 +0000 Subject: [PATCH] Implemented hosts_avoid_pipelining in the smtp transport. --- doc/doc-txt/ChangeLog | 4 +++- doc/doc-txt/NewStuff | 6 +++++- doc/doc-txt/OptionLists.txt | 3 ++- src/src/transports/smtp.c | 10 ++++++++-- src/src/transports/smtp.h | 3 ++- test/confs/0217 | 4 +++- test/log/0217 | 6 ++++++ test/scripts/0000-Basic/0217 | 26 ++++++++++++++++++++++++++ test/stderr/0217 | 33 +++++++++++++++++++++++++++++++++ test/stdout/0217 | 28 ++++++++++++++++++++++++++++ 10 files changed, 116 insertions(+), 7 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index fd3b4c420..715a57898 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.472 2007/02/06 14:19:00 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.473 2007/02/06 14:49:13 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -85,6 +85,8 @@ PH/19 Change 4.64/PH/36 introduced a bug: when address_retry_include_sender item, thus causing premature timeout of the address. The bug is now fixed. +PH/20 Added hosts_avoid_pipelining to the smtp transport. + Exim version 4.66 ----------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index b05db458a..3fbb1b662 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.138 2007/02/06 12:19:27 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.139 2007/02/06 14:49:13 ph10 Exp $ New Features in Exim -------------------- @@ -282,6 +282,10 @@ Version 4.67 The value is expanded every time it is needed. If the expansion fails, a panic is logged, and the default setting is used. +14. The smtp transport has a new option called hosts_avoid_pipelining. It can + be used to suppress the use of PIPELINING to certain hosts, while still + supporting the other SMTP extensions (cf hosts_avoid_tls). + Version 4.66 ------------ diff --git a/doc/doc-txt/OptionLists.txt b/doc/doc-txt/OptionLists.txt index 67b03c793..4d7e3bdad 100644 --- a/doc/doc-txt/OptionLists.txt +++ b/doc/doc-txt/OptionLists.txt @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/OptionLists.txt,v 1.29 2007/01/18 15:35:42 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/OptionLists.txt,v 1.30 2007/02/06 14:49:13 ph10 Exp $ LISTS OF EXIM OPTIONS --------------------- @@ -265,6 +265,7 @@ host_reject_connection host list unset main hosts string unset iplookup 4.00 string list* unset smtp hosts_avoid_esmtp host list unset smtp 4.21 +hosts_avoid_pipelining host list unset smtp 4.67 hosts_avoid_tls host list unset smtp 3.20 hosts_connection_nolog host list unset main 4.43 hosts_max_try integer 5 smtp 3.20 diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 0bc5b533e..509ff1949 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/smtp.c,v 1.34 2007/02/06 14:19:00 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/smtp.c,v 1.35 2007/02/06 14:49:13 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -77,6 +77,8 @@ optionlist smtp_transport_options[] = { (void *)offsetof(smtp_transport_options_block, hosts) }, { "hosts_avoid_esmtp", opt_stringptr, (void *)offsetof(smtp_transport_options_block, hosts_avoid_esmtp) }, + { "hosts_avoid_pipelining", opt_stringptr, + (void *)offsetof(smtp_transport_options_block, hosts_avoid_pipelining) }, #ifdef SUPPORT_TLS { "hosts_avoid_tls", opt_stringptr, (void *)offsetof(smtp_transport_options_block, hosts_avoid_tls) }, @@ -160,6 +162,7 @@ smtp_transport_options_block smtp_transport_option_defaults = { NULL, /* hosts_require_auth */ NULL, /* hosts_require_tls */ NULL, /* hosts_avoid_tls */ + NULL, /* hosts_avoid_pipelining */ NULL, /* hosts_avoid_esmtp */ NULL, /* hosts_nopass_tls */ 5*60, /* command_timeout */ @@ -1189,9 +1192,12 @@ if (continue_hostname == NULL PCRE_EOPT, NULL, 0) >= 0; /* Note whether the server supports PIPELINING. If hosts_avoid_esmtp matched - the current host, esmtp will be false, so PIPELINING can never be used. */ + the current host, esmtp will be false, so PIPELINING can never be used. If + the current host matches hosts_avoid_pipelining, don't do it. */ smtp_use_pipelining = esmtp && + verify_check_this_host(&(ob->hosts_avoid_pipelining), NULL, host->name, + host->address, NULL) != OK && pcre_exec(regex_PIPELINING, NULL, CS buffer, Ustrlen(CS buffer), 0, PCRE_EOPT, NULL, 0) >= 0; diff --git a/src/src/transports/smtp.h b/src/src/transports/smtp.h index 4f5dec707..63e76eb93 100644 --- a/src/src/transports/smtp.h +++ b/src/src/transports/smtp.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/smtp.h,v 1.11 2007/01/18 15:35:43 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/smtp.h,v 1.12 2007/02/06 14:49:13 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -24,6 +24,7 @@ typedef struct { uschar *hosts_require_auth; uschar *hosts_require_tls; uschar *hosts_avoid_tls; + uschar *hosts_avoid_pipelining; uschar *hosts_avoid_esmtp; uschar *hosts_nopass_tls; int command_timeout; diff --git a/test/confs/0217 b/test/confs/0217 index 7ffc1b099..32c46e232 100644 --- a/test/confs/0217 +++ b/test/confs/0217 @@ -1,5 +1,7 @@ # Exim test configuration 0217 +HAP= + exim_path = EXIM_PATH host_lookup_order = bydns primary_hostname = myhost.test.ex @@ -43,7 +45,7 @@ send_to_server: command_timeout = 1s hosts = 127.0.0.1 port = PORT_S - + HAP # ----- Retry ----- diff --git a/test/log/0217 b/test/log/0217 index 4913cb03f..c4e582c90 100644 --- a/test/log/0217 +++ b/test/log/0217 @@ -119,3 +119,9 @@ 1999-03-02 09:44:33 10HmbO-0005vi-00 ** CALLER@test.ex R=bounce: just discard 1999-03-02 09:44:33 10HmbO-0005vi-00 CALLER@test.ex: error ignored 1999-03-02 09:44:33 10HmbO-0005vi-00 Completed +1999-03-02 09:44:33 10HmbP-0005vi-00 <= CALLER@test.ex U=CALLER P=local S=sss +1999-03-02 09:44:33 10HmbP-0005vi-00 => w@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] +1999-03-02 09:44:33 10HmbP-0005vi-00 -> x@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] +1999-03-02 09:44:33 10HmbP-0005vi-00 -> y@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] +1999-03-02 09:44:33 10HmbP-0005vi-00 -> z@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] +1999-03-02 09:44:33 10HmbP-0005vi-00 Completed diff --git a/test/scripts/0000-Basic/0217 b/test/scripts/0000-Basic/0217 index c91d24254..5722eb4d2 100644 --- a/test/scripts/0000-Basic/0217 +++ b/test/scripts/0000-Basic/0217 @@ -316,4 +316,30 @@ RCPT TO exim -odi a b c d e . **** +# Discard retry data +sudo rm DIR/spool/db/* +# +# Test hosts_avoid_pipelining +server PORT_S +220 Server ready +EHLO +250-OK +250 PIPELINING +MAIL FROM +250 OK +RCPT TO +250 OK +RCPT TO +250 OK +RCPT TO +250 OK +RCPT TO +250 OK +DATA +351 Send more +. +250 OK +**** +exim -v -odi -DHAP=hosts_avoid_pipelining=127.0.0.1 w x y z +**** no_msglog_check diff --git a/test/stderr/0217 b/test/stderr/0217 index 30ab686c2..32b046de1 100644 --- a/test/stderr/0217 +++ b/test/stderr/0217 @@ -228,3 +228,36 @@ LOG: MAIN CALLER@test.ex: error ignored LOG: MAIN Completed +LOG: MAIN + <= CALLER@test.ex U=CALLER P=local S=sss +delivering 10HmbP-0005vi-00 +Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected + SMTP<< 220 Server ready + SMTP>> EHLO myhost.test.ex + SMTP<< 250-OK + 250 PIPELINING + SMTP>> MAIL FROM: + SMTP<< 250 OK + SMTP>> RCPT TO: + SMTP<< 250 OK + SMTP>> RCPT TO: + SMTP<< 250 OK + SMTP>> RCPT TO: + SMTP<< 250 OK + SMTP>> RCPT TO: + SMTP<< 250 OK + SMTP>> DATA + SMTP<< 351 Send more + SMTP>> writing message and terminating "." + SMTP<< 250 OK + SMTP>> QUIT +LOG: MAIN + => w@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] +LOG: MAIN + -> x@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] +LOG: MAIN + -> y@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] +LOG: MAIN + -> z@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] +LOG: MAIN + Completed diff --git a/test/stdout/0217 b/test/stdout/0217 index af856787b..be5634b31 100644 --- a/test/stdout/0217 +++ b/test/stdout/0217 @@ -289,3 +289,31 @@ RCPT TO: RCPT TO: 550 NO End of script +Listening on port 1224 ... +Connection request from [127.0.0.1] +220 Server ready +EHLO myhost.test.ex +250-OK +250 PIPELINING +MAIL FROM: +250 OK +RCPT TO: +250 OK +RCPT TO: +250 OK +RCPT TO: +250 OK +RCPT TO: +250 OK +DATA +351 Send more +Received: from CALLER by myhost.test.ex with local (Exim x.yz) + (envelope-from ) + id 10HmbP-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000 +Message-Id: +From: CALLER_NAME +Date: Tue, 2 Mar 1999 09:44:33 +0000 + +. +250 OK +End of script -- 2.30.2