From e501e3fb7abc61d6dd799802873e8e84209e5cd7 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 23 Dec 2012 15:34:12 +0000 Subject: [PATCH] Add try_prdr option to smtp transport. --- src/src/deliver.c | 5 +++++ src/src/globals.c | 1 + src/src/globals.h | 1 + src/src/transports/smtp.c | 13 +++++++++++++ src/src/transports/smtp.h | 3 +++ 5 files changed, 23 insertions(+) diff --git a/src/src/deliver.c b/src/src/deliver.c index 79d431b37..f20ea4166 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -6096,6 +6096,11 @@ if (addr_remote != NULL) regex_must_compile(US"\\n250[\\s\\-]STARTTLS(\\s|\\n|$)", FALSE, TRUE); #endif + #ifdef EXPERIMENTAL_PRDR + if (regex_PRDR == NULL) regex_PRDR = + regex_must_compile(US"\\n250[\\s\\-]PRDR(\\s|\\n|$)", FALSE, TRUE); + #endif + /* Now sort the addresses if required, and do the deliveries. The yield of do_remote_deliveries is FALSE when mua_wrapper is set and all addresses cannot be delivered in one transaction. */ diff --git a/src/src/globals.c b/src/src/globals.c index 70d606e3e..911b940cd 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -150,6 +150,7 @@ uschar *tls_verify_hosts = NULL; BOOL prdr_enable = TRUE; BOOL prdr_requested = FALSE; //recipient_item *prdr_recipients_list = NULL; +const pcre *regex_PRDR = NULL; #endif /* Input-reading functions for messages, so we can use special ones for diff --git a/src/src/globals.h b/src/src/globals.h index 1389a8bdb..a484bdd07 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -149,6 +149,7 @@ extern uschar *acl_smtp_connect; /* ACL run on SMTP connection */ extern uschar *acl_smtp_data; /* ACL run after DATA received */ #ifdef EXPERIMENTAL_PRDR extern uschar *acl_smtp_data_prdr; /* ACL run after DATA received if in PRDR mode*/ +extern const pcre *regex_PRDR; /* For recognizing PRDR settings */ #endif #ifndef DISABLE_DKIM extern uschar *acl_smtp_dkim; /* ACL run for DKIM signatures / domains */ diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 6c3507609..505e0e8ee 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -106,6 +106,10 @@ optionlist smtp_transport_options[] = { #endif { "hosts_try_auth", opt_stringptr, (void *)offsetof(smtp_transport_options_block, hosts_try_auth) }, +#ifdef EXPERIMENTAL_PRDR + { "hosts_try_prdr", opt_stringptr, + (void *)offsetof(smtp_transport_options_block, hosts_try_prdr) }, +#endif #ifdef SUPPORT_TLS { "hosts_verify_avoid_tls", opt_stringptr, (void *)offsetof(smtp_transport_options_block, hosts_verify_avoid_tls) }, @@ -172,6 +176,9 @@ smtp_transport_options_block smtp_transport_option_defaults = { NULL, /* serialize_hosts */ NULL, /* hosts_try_auth */ NULL, /* hosts_require_auth */ +#ifdef EXPERIMENTAL_PRDR + NULL, /* hosts_try_prdr */ +#endif NULL, /* hosts_require_tls */ NULL, /* hosts_avoid_tls */ US"*", /* hosts_verify_avoid_tls */ @@ -1066,6 +1073,12 @@ goto SEND_QUIT; pcre_exec(regex_STARTTLS, NULL, CS buffer, Ustrlen(buffer), 0, PCRE_EOPT, NULL, 0) >= 0; #endif + + #ifdef EXPERIMENTAL_PRDR + prdr_enable = esmtp && + pcre_exec(regex_PRDR, NULL, CS buffer, Ustrlen(buffer), 0, + PCRE_EOPT, NULL, 0) >= 0; + #endif } /* For continuing deliveries down the same channel, the socket is the standard diff --git a/src/src/transports/smtp.h b/src/src/transports/smtp.h index 79f1b8c50..ef53292bc 100644 --- a/src/src/transports/smtp.h +++ b/src/src/transports/smtp.h @@ -21,6 +21,9 @@ typedef struct { uschar *serialize_hosts; uschar *hosts_try_auth; uschar *hosts_require_auth; +#ifdef EXPERIMENTAL_PRDR + uschar *hosts_try_prdr; +#endif uschar *hosts_require_tls; uschar *hosts_avoid_tls; uschar *hosts_verify_avoid_tls; -- 2.25.1