From 382afc6ba69545d52398da6b437e487aa23f185d Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Tue, 28 Feb 2006 12:42:47 +0000 Subject: [PATCH] Add authenticated_sender_force to the smtp transport. --- doc/doc-txt/ChangeLog | 4 +++- doc/doc-txt/NewStuff | 6 +++++- doc/doc-txt/OptionLists.txt | 3 ++- src/src/transports/smtp.c | 8 ++++++-- src/src/transports/smtp.h | 3 ++- test/confs/0001 | 1 + test/confs/0215 | 4 ++++ test/log/0215 | 4 ++++ test/scripts/0000-Basic/0215 | 30 ++++++++++++++++++++++++++++++ test/stdout/0215 | 24 ++++++++++++++++++++++++ 10 files changed, 81 insertions(+), 6 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index bbf590a1e..c508ee545 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.314 2006/02/28 11:25:40 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.315 2006/02/28 12:42:47 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -239,6 +239,8 @@ PH/45 When the plaintext authenticator is running as a client, the server's PH/46 Messages that are created by the autoreply transport now contains a References: header, in accordance with RFCs 2822 and 3834. +PH/47 Added authenticated_sender_force to the smtp transport. + Exim version 4.60 ----------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 04fedd633..d99a1347b 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.91 2006/02/28 11:25:40 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.92 2006/02/28 12:42:47 ph10 Exp $ New Features in Exim -------------------- @@ -98,6 +98,10 @@ PH/14 Messages created by the autoreply transport now contain a References: and then the final 11 are copied, before adding the message ID of the incoming message. +PH/15 The smtp transport has a new option called authenticated_sender_force. + When set true, it allows the authenticated_sender option's value to be + used, even if Exim has not authenticated as a client. + Version 4.60 ------------ diff --git a/doc/doc-txt/OptionLists.txt b/doc/doc-txt/OptionLists.txt index 5e5815b42..d4c27305a 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.18 2006/02/23 12:41:22 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/OptionLists.txt,v 1.19 2006/02/28 12:42:47 ph10 Exp $ LISTS OF EXIM OPTIONS --------------------- @@ -83,6 +83,7 @@ allow_symlink boolean false appendfile allow_utf8_domains boolean false main 4.14 auth_advertise_hosts host list "*" main 4.00 authenticated_sender string* unset smtp 4.14 +authenticated_sender_force boolean false smtp 4.61 authenticate_hosts host list unset smtp 3.13 auto_thaw time 0s main av_scanner string* + main 4.50 with content scan diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 93cbd221f..345fb951b 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.22 2006/02/23 12:41:23 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/smtp.c,v 1.23 2006/02/28 12:42:47 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -25,6 +25,8 @@ optionlist smtp_transport_options[] = { (void *)offsetof(smtp_transport_options_block, allow_localhost) }, { "authenticated_sender", opt_stringptr, (void *)offsetof(smtp_transport_options_block, authenticated_sender) }, + { "authenticated_sender_force", opt_bool, + (void *)offsetof(smtp_transport_options_block, authenticated_sender_force) }, { "command_timeout", opt_time, (void *)offsetof(smtp_transport_options_block, command_timeout) }, { "connect_timeout", opt_time, @@ -158,6 +160,7 @@ smtp_transport_options_block smtp_transport_option_defaults = { 5, /* hosts_max_try */ 50, /* hosts_max_try_hardlimit */ FALSE, /* allow_localhost */ + FALSE, /* authenticated_sender_force */ FALSE, /* gethostbyname */ TRUE, /* dns_qualify_single */ FALSE, /* dns_search_parents */ @@ -1310,7 +1313,8 @@ if (smtp_use_size) /* Add the authenticated sender address if present */ -if (smtp_authenticated && local_authenticated_sender != NULL) +if ((smtp_authenticated || ob->authenticated_sender_force) && + local_authenticated_sender != NULL) { string_format(p, sizeof(buffer) - (p-buffer), " AUTH=%s", auth_xtextencode(local_authenticated_sender, diff --git a/src/src/transports/smtp.h b/src/src/transports/smtp.h index cd6f396c6..05f02bc00 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.7 2006/02/07 11:19:03 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/smtp.h,v 1.8 2006/02/28 12:42:47 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -34,6 +34,7 @@ typedef struct { int hosts_max_try; int hosts_max_try_hardlimit; BOOL allow_localhost; + BOOL authenticated_sender_force; BOOL gethostbyname; BOOL dns_qualify_single; BOOL dns_search_parents; diff --git a/test/confs/0001 b/test/confs/0001 index 049cd1787..aa07ef053 100644 --- a/test/confs/0001 +++ b/test/confs/0001 @@ -574,6 +574,7 @@ appendfile4: smtp: driver = smtp authenticated_sender = abcde + authenticated_sender_force = true no_allow_localhost command_timeout = 5m connect_timeout = 0s diff --git a/test/confs/0215 b/test/confs/0215 index b513fcd6c..102fd0ada 100644 --- a/test/confs/0215 +++ b/test/confs/0215 @@ -1,6 +1,8 @@ # Exim test configuration 0215 IGNORE_QUOTA=false +AUTHS= +AUTHF= exim_path = EXIM_PATH host_lookup_order = bydns @@ -45,6 +47,8 @@ lmtp: port = PORT_S protocol = LMTP lmtp_ignore_quota = IGNORE_QUOTA + AUTHS + AUTHF # ----- Retry ----- diff --git a/test/log/0215 b/test/log/0215 index 9e9b5bba8..9dc3aaf90 100644 --- a/test/log/0215 +++ b/test/log/0215 @@ -45,3 +45,7 @@ 1999-03-02 09:44:33 10HmbF-0005vi-00 -> userxy@myhost.test.ex F= R=smartuser T=lmtp H=127.0.0.1 [127.0.0.1] 1999-03-02 09:44:33 10HmbF-0005vi-00 -> userxz@myhost.test.ex F= R=smartuser T=lmtp H=127.0.0.1 [127.0.0.1] 1999-03-02 09:44:33 10HmbF-0005vi-00 Completed +1999-03-02 09:44:33 10HmbG-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss +1999-03-02 09:44:33 10HmbG-0005vi-00 == userx@myhost.test.ex R=smartuser T=lmtp defer (-44): SMTP error from remote mail server after RCPT TO:: host 127.0.0.1 [127.0.0.1]: 450 LATER +1999-03-02 09:44:33 10HmbH-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss +1999-03-02 09:44:33 10HmbH-0005vi-00 == userx@myhost.test.ex R=smartuser T=lmtp defer (-44): SMTP error from remote mail server after RCPT TO:: host 127.0.0.1 [127.0.0.1]: 450 LATER diff --git a/test/scripts/0000-Basic/0215 b/test/scripts/0000-Basic/0215 index ab108bc87..47f1f1cc8 100644 --- a/test/scripts/0000-Basic/0215 +++ b/test/scripts/0000-Basic/0215 @@ -189,4 +189,34 @@ QUIT exim -odi -DIGNORE_QUOTA=true userxx userxy userxz This is a test message. **** +# Tests for authenticated_sender forcing: this one doesn't do it +server PORT_S +220 ESMTP +LHLO +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +450 LATER +QUIT +250 OK +**** +exim -odi -DAUTHS=authenticated_sender=xxx@yyy userx +Another test message. +**** +# Tests for authenticated_sender forcing: this one does it +server PORT_S +220 ESMTP +LHLO +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +450 LATER +QUIT +250 OK +**** +exim -odi -DAUTHS=authenticated_sender=xxx@yyy -DAUTHF=authenticated_sender_force userx +Another test message. +**** no_msglog_check diff --git a/test/stdout/0215 b/test/stdout/0215 index a562016e0..d6d06cfe6 100644 --- a/test/stdout/0215 +++ b/test/stdout/0215 @@ -217,3 +217,27 @@ This is a test message. QUIT 250 OK End of script +Listening on port 1224 ... +Connection request from [127.0.0.1] +220 ESMTP +LHLO myhost.test.ex +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +450 LATER +QUIT +250 OK +End of script +Listening on port 1224 ... +Connection request from [127.0.0.1] +220 ESMTP +LHLO myhost.test.ex +250 OK +MAIL FROM: AUTH=xxx@yyy +250 Sender OK +RCPT TO: +450 LATER +QUIT +250 OK +End of script -- 2.30.2