From cf8b11a5399e64e50b6cd58f56a98197aca599d8 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Tue, 30 Jan 2007 11:45:20 +0000 Subject: [PATCH] Add control=no_pipelining. --- doc/doc-txt/ChangeLog | 4 +++- doc/doc-txt/NewStuff | 8 +++++++- src/src/acl.c | 18 +++++++++++++++--- src/src/globals.c | 3 ++- src/src/globals.h | 3 ++- src/src/smtp_in.c | 6 ++++-- test/confs/0549 | 26 ++++++++++++++++++++++++++ test/log/0549 | 1 + test/scripts/0000-Basic/0549 | 25 +++++++++++++++++++++++++ test/stdout/0549 | 30 ++++++++++++++++++++++++++++++ 10 files changed, 115 insertions(+), 9 deletions(-) create mode 100644 test/confs/0549 create mode 100644 test/log/0549 create mode 100644 test/scripts/0000-Basic/0549 create mode 100644 test/stdout/0549 diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 1f9911d16..ab30b633e 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.463 2007/01/25 15:51:28 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.464 2007/01/30 11:45:20 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -60,6 +60,8 @@ PH/10 The acl_not_smtp_start ACL was, contrary to the documentation, not being (output by running exiwhat) was not always getting set for -bs and -bS input. This is fixed, and it now also says "batched" for BSMTP. +PH/11 Added control=no_pipelining. + Exim version 4.66 ----------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 3fe06394f..f5b8bd949 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.130 2007/01/23 14:34:02 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.131 2007/01/30 11:45:20 ph10 Exp $ New Features in Exim -------------------- @@ -197,6 +197,12 @@ Version 4.67 go while a single connection is being processed. When a child process terminates, the daemon decrements the variable. + 6. There's a new control called no_pipelining, which does what its name + suggests. It turns off the advertising of the PIPELINING extension to SMTP. + To be useful, this control must be obeyed before Exim sends its response to + an EHLO command. Therefore, it should normally appear in an ACL controlled + by acl_smtp_connect or acl_smtp_helo. + Version 4.66 ------------ diff --git a/src/src/acl.c b/src/src/acl.c index 73f0614af..3e06cdf30 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/acl.c,v 1.68 2007/01/08 10:50:17 ph10 Exp $ */ +/* $Cambridge: exim/src/src/acl.c,v 1.69 2007/01/30 11:45:20 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -186,7 +186,8 @@ enum { #endif CONTROL_FAKEDEFER, CONTROL_FAKEREJECT, - CONTROL_NO_MULTILINE + CONTROL_NO_MULTILINE, + CONTROL_NO_PIPELINING }; /* ACL control names; keep in step with the table above! This list is used for @@ -214,7 +215,10 @@ static uschar *controls[] = { #ifdef WITH_CONTENT_SCAN US"no_mbox_unspool", #endif - US"no_multiline" + US"fakedefer", + US"fakereject", + US"no_multiline", + US"no_pipelining", }; /* Flags to indicate for which conditions /modifiers a string expansion is done @@ -586,6 +590,9 @@ static unsigned int control_forbids[] = { (1<next) no_multiline_responses = TRUE; break; + case CONTROL_NO_PIPELINING: + pipelining_enable = FALSE; + break; + case CONTROL_FAKEDEFER: case CONTROL_FAKEREJECT: fake_response = (control_type == CONTROL_FAKEDEFER) ? DEFER : FAIL; diff --git a/src/src/globals.c b/src/src/globals.c index 74b6554cf..969ac7189 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.c,v 1.64 2007/01/22 16:29:54 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.c,v 1.65 2007/01/30 11:45:20 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -790,6 +790,7 @@ BOOL parse_found_group = FALSE; uschar *percent_hack_domains = NULL; uschar *pid_file_path = US PID_FILE_PATH "\0<--------------Space to patch pid_file_path->"; +BOOL pipelining_enable = TRUE; uschar *pipelining_advertise_hosts = US"*"; BOOL preserve_message_logs = FALSE; uschar *primary_hostname = NULL; diff --git a/src/src/globals.h b/src/src/globals.h index 660d62fe5..75f665041 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.h,v 1.45 2007/01/22 16:29:54 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.h,v 1.46 2007/01/30 11:45:20 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -495,6 +495,7 @@ extern BOOL parse_found_group; /* In the middle of a group */ extern uschar *percent_hack_domains; /* Local domains for which '% operates */ extern uschar *pid_file_path; /* For writing daemon pids */ extern uschar *pipelining_advertise_hosts; /* As it says */ +extern BOOL pipelining_enable; /* As it says */ extern BOOL preserve_message_logs; /* Save msglog files */ extern uschar *primary_hostname; /* Primary name of this computer */ extern BOOL print_topbitchars; /* Topbit chars are printing chars */ diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index b6a6669e9..d0ac95967 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.52 2007/01/23 14:34:02 ph10 Exp $ */ +/* $Cambridge: exim/src/src/smtp_in.c,v 1.53 2007/01/30 11:45:20 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1244,6 +1244,7 @@ synprot_error_count = unknown_command_count = nonmail_command_count = 0; smtp_delay_mail = smtp_rlm_base; auth_advertised = FALSE; pipelining_advertised = FALSE; +pipelining_enable = TRUE; sync_cmd_limit = NON_SYNC_CMD_NON_PIPELINING; memset(sender_host_cache, 0, sizeof(sender_host_cache)); @@ -2851,7 +2852,8 @@ while (done <= 0) /* Exim is quite happy with pipelining, so let the other end know that it is safe to use it, unless advertising is disabled. */ - if (verify_check_host(&pipelining_advertise_hosts) == OK) + if (pipelining_enable && + verify_check_host(&pipelining_advertise_hosts) == OK) { s = string_cat(s, &size, &ptr, smtp_code, 3); s = string_cat(s, &size, &ptr, US"-PIPELINING\r\n", 13); diff --git a/test/confs/0549 b/test/confs/0549 new file mode 100644 index 000000000..280d4d06c --- /dev/null +++ b/test/confs/0549 @@ -0,0 +1,26 @@ +# Exim test configuration 0549 + +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 ----- + +acl_smtp_connect = check_connect + + +# ----- ACL ----- + +begin ACL + +check_connect: + accept hosts = 127.0.0.1 + control = no_pipelining + accept + +# End diff --git a/test/log/0549 b/test/log/0549 new file mode 100644 index 000000000..dc36d2697 --- /dev/null +++ b/test/log/0549 @@ -0,0 +1 @@ +1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225 diff --git a/test/scripts/0000-Basic/0549 b/test/scripts/0000-Basic/0549 new file mode 100644 index 000000000..574d7edf0 --- /dev/null +++ b/test/scripts/0000-Basic/0549 @@ -0,0 +1,25 @@ +# no_pipelining +need_ipv4 +# +exim -DSERVER=server -bd -oX PORT_D +**** +client 127.0.0.1 PORT_D +??? 220 +ehlo abcd +??? 250- +??? 250- +??? 250 +quit +??? 221 +**** +client HOSTIPV4 PORT_D +??? 220 +ehlo abcd +??? 250- +??? 250- +??? 250- +??? 250 +quit +??? 221 +**** +killdaemon diff --git a/test/stdout/0549 b/test/stdout/0549 new file mode 100644 index 000000000..6fc4bf160 --- /dev/null +++ b/test/stdout/0549 @@ -0,0 +1,30 @@ +Connecting to 127.0.0.1 port 1225 ... connected +??? 220 +<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 +>>> ehlo abcd +??? 250- +<<< 250-myhost.test.ex Hello abcd [127.0.0.1] +??? 250- +<<< 250-SIZE 52428800 +??? 250 +<<< 250 HELP +>>> quit +??? 221 +<<< 221 myhost.test.ex closing connection +End of script +Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected +??? 220 +<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 +>>> ehlo abcd +??? 250- +<<< 250-myhost.test.ex Hello abcd [ip4.ip4.ip4.ip4] +??? 250- +<<< 250-SIZE 52428800 +??? 250- +<<< 250-PIPELINING +??? 250 +<<< 250 HELP +>>> quit +??? 221 +<<< 221 myhost.test.ex closing connection +End of script -- 2.25.1