From 2a4be8f93bd41c49707fe5e6ce2d782b709b551c Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Tue, 31 May 2005 10:58:18 +0000 Subject: [PATCH] Add "fullpostmaster" to check without a domain, if the domained version fails. --- doc/doc-txt/ChangeLog | 5 ++++- doc/doc-txt/NewStuff | 7 ++++++- src/src/acl.c | 7 ++++++- src/src/macros.h | 4 ++-- src/src/verify.c | 28 +++++++++++++++++++++++++--- 5 files changed, 43 insertions(+), 8 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 47682b85f..f5e8499b6 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.145 2005/05/25 20:32:44 tom Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.146 2005/05/31 10:58:18 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -58,6 +58,9 @@ PH/06 There is a timeout for writing blocks of data, set by, e.g. data_timeout TK/04 Added simple SPF lookup method in EXPERIMENTAL_SPF. See NewStuff for details. Thanks to Chris Webb for the patch! +PH/07 Added "fullpostmaster" verify option, which does a check to + without a domain if the check to fails. + Exim version 4.51 ----------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 7a5bf4f15..d0997d1f0 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.47 2005/05/25 20:33:28 tom Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.48 2005/05/31 10:58:18 ph10 Exp $ New Features in Exim -------------------- @@ -247,6 +247,11 @@ TK/01 Added an 'spf' lookup type that will return an SPF result for a given Patch submitted by Chris Webb . +PH/02 There's a new verify callout option, "fullpostmaster", which first acts + as "postmaster" and checks the recipient . If that + fails, it tries just , without a domain, in accordance with + the specification in RFC 2821. + Version 4.51 ------------ diff --git a/src/src/acl.c b/src/src/acl.c index a96e2d188..08c69c679 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/acl.c,v 1.35 2005/05/25 09:58:16 fanf2 Exp $ */ +/* $Cambridge: exim/src/src/acl.c,v 1.36 2005/05/31 10:58:18 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1512,6 +1512,11 @@ while ((ss = string_nextinlist(&list, &sep, big_buffer, big_buffer_size)) else if (strcmpic(opt, US"use_postmaster") == 0) verify_options |= vopt_callout_recippmaster; else if (strcmpic(opt, US"postmaster") == 0) pm_mailfrom = US""; + else if (strcmpic(opt, US"fullpostmaster") == 0) + { + pm_mailfrom = US""; + verify_options |= vopt_callout_fullpm; + } else if (strncmpic(opt, US"mailfrom", 8) == 0) { diff --git a/src/src/macros.h b/src/src/macros.h index 9ab6f0295..55fdd846d 100644 --- a/src/src/macros.h +++ b/src/src/macros.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/macros.h,v 1.13 2005/05/10 10:19:11 ph10 Exp $ */ +/* $Cambridge: exim/src/src/macros.h,v 1.14 2005/05/31 10:58:18 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -602,7 +602,7 @@ enum { v_none, v_sender, v_recipient, v_expn }; #define vopt_is_recipient 0x0002 #define vopt_qualify 0x0004 #define vopt_expn 0x0008 -#define vopt_callout_postmaster 0x0010 /* during callout */ +#define vopt_callout_fullpm 0x0010 /* full postmaster during callout */ #define vopt_callout_random 0x0020 /* during callout */ #define vopt_callout_no_cache 0x0040 /* disable callout cache */ #define vopt_callout_recipsender 0x0080 /* use real sender to verify recip */ diff --git a/src/src/verify.c b/src/src/verify.c index abdb5facc..e346cf986 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/verify.c,v 1.17 2005/05/24 08:15:02 tom Exp $ */ +/* $Cambridge: exim/src/src/verify.c,v 1.18 2005/05/31 10:58:18 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -128,6 +128,7 @@ Arguments: options the verification options - these bits are used: vopt_is_recipient => this is a recipient address vopt_callout_no_cache => don't use callout cache + vopt_callout_fullpm => if postmaster check, do full one vopt_callout_random => do the "random" thing vopt_callout_recipsender => use real sender for recipient vopt_callout_recippmaster => use postmaster for recipient @@ -563,7 +564,8 @@ for (host = host_list; host != NULL && !done; host = host->next) new_address_record.result = ccache_reject; } - /* Do postmaster check if requested */ + /* Do postmaster check if requested; if a full check is required, we + check for RCPT TO: (no domain) in accordance with RFC 821. */ if (done && pm_mailfrom != NULL) { @@ -577,10 +579,29 @@ for (host = host_list; host != NULL && !done; host = host->next) smtp_read_response(&inblock, responsebuffer, sizeof(responsebuffer), '2', callout) && + /* First try using the current domain */ + + (( smtp_write_command(&outblock, FALSE, "RCPT TO:\r\n", addr->domain) >= 0 && smtp_read_response(&inblock, responsebuffer, - sizeof(responsebuffer), '2', callout); + sizeof(responsebuffer), '2', callout) + ) + + || + + /* If that doesn't work, and a full check is requested, + try without the domain. */ + + ( + (options & vopt_callout_fullpm) != 0 && + smtp_write_command(&outblock, FALSE, + "RCPT TO:\r\n") >= 0 && + smtp_read_response(&inblock, responsebuffer, + sizeof(responsebuffer), '2', callout) + )); + + /* Sort out the cache record */ new_domain_record.postmaster_stamp = time(NULL); @@ -791,6 +812,7 @@ Arguments: These ones are used by do_callout() -- the options variable is passed to it. + vopt_callout_fullpm => if postmaster check, do full one vopt_callout_no_cache => don't use callout cache vopt_callout_random => do the "random" thing vopt_callout_recipsender => use real sender for recipient -- 2.25.1