From 8ccd00b14ecc7c3c806882a54a9216f531571716 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Tue, 13 May 2014 15:44:09 +0100 Subject: Move PRDR out of EXPERIMENTAL --- src/src/EDITME | 6 ++++-- src/src/acl.c | 44 ++++++++++++++++++++++---------------------- src/src/deliver.c | 9 +++++---- src/src/exim.c | 3 --- src/src/globals.c | 8 ++++---- src/src/globals.h | 4 ++-- src/src/macros.h | 2 +- src/src/readconf.c | 4 ++-- src/src/receive.c | 35 ++++++++++++++++------------------- src/src/smtp_in.c | 36 ++++++++++++++++++++---------------- src/src/structs.h | 2 +- src/src/transports/smtp.c | 26 +++++++++++++------------- src/src/transports/smtp.h | 2 +- 13 files changed, 91 insertions(+), 90 deletions(-) (limited to 'src') diff --git a/src/src/EDITME b/src/src/EDITME index d13b1b13a..7d58af744 100644 --- a/src/src/EDITME +++ b/src/src/EDITME @@ -410,6 +410,10 @@ EXIM_MONITOR=eximon.bin # DISABLE_DKIM=yes +#------------------------------------------------------------------------------ +# Uncomment the following line to remove Per-Recipient-Data-Response support. + +# DISABLE_PRDR=yes #------------------------------------------------------------------------------ # By default, Exim has support for checking the AD bit in a DNS response, to @@ -466,8 +470,6 @@ EXIM_MONITOR=eximon.bin # CFLAGS += -I/usr/local/include # LDFLAGS += -lopendmarc -# Uncomment the following line to add Per-Recipient-Data-Response support. -# EXPERIMENTAL_PRDR=yes # Uncomment the following line to support Transport post-delivery actions, # eg. for logging to a database. diff --git a/src/src/acl.c b/src/src/acl.c index 42b9091c3..e8a0657f2 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -397,7 +397,7 @@ static unsigned int cond_forbids[] = { (unsigned int) ~((1< 1 ) diff --git a/src/src/deliver.c b/src/src/deliver.c index 777ff8dc7..6bdfbd4da 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -830,7 +830,7 @@ else } } - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR if (addr->flags & af_prdr_used) s = string_append(s, &size, &ptr, 1, US" PRDR"); #endif @@ -3043,9 +3043,10 @@ while (!done) while (*ptr++); break; -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR case 'P': - addr->flags |= af_prdr_used; break; + addr->flags |= af_prdr_used; + break; #endif case 'A': @@ -6280,7 +6281,7 @@ if (addr_remote != NULL) regex_must_compile(US"\\n250[\\s\\-]STARTTLS(\\s|\\n|$)", FALSE, TRUE); #endif - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR if (regex_PRDR == NULL) regex_PRDR = regex_must_compile(US"\\n250[\\s\\-]PRDR(\\s|\\n|$)", FALSE, TRUE); #endif diff --git a/src/src/exim.c b/src/src/exim.c index fa0cf4940..ded12fa34 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -822,9 +822,6 @@ fprintf(f, "Support for:"); #ifdef EXPERIMENTAL_OCSP fprintf(f, " Experimental_OCSP"); #endif -#ifdef EXPERIMENTAL_PRDR - fprintf(f, " Experimental_PRDR"); -#endif #ifdef EXPERIMENTAL_PROXY fprintf(f, " Experimental_Proxy"); #endif diff --git a/src/src/globals.c b/src/src/globals.c index a2cc50313..a25b06a05 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -155,7 +155,7 @@ uschar *tls_verify_certificates= NULL; uschar *tls_verify_hosts = NULL; #endif -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR /* Per Recipient Data Response variables */ BOOL prdr_enable = FALSE; BOOL prdr_requested = FALSE; @@ -218,7 +218,7 @@ uschar *acl_removed_headers = NULL; uschar *acl_smtp_auth = NULL; uschar *acl_smtp_connect = NULL; uschar *acl_smtp_data = NULL; -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR uschar *acl_smtp_data_prdr = NULL; #endif #ifndef DISABLE_DKIM @@ -254,7 +254,7 @@ uschar *acl_wherenames[] = { US"RCPT", US"MIME", US"DKIM", US"DATA", -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR US"PRDR", #endif US"non-SMTP", @@ -279,7 +279,7 @@ uschar *acl_wherecodes[] = { US"550", /* RCPT */ US"550", /* MIME */ US"550", /* DKIM */ US"550", /* DATA */ -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR US"550", /* RCPT PRDR */ #endif US"0", /* not SMTP; not relevant */ diff --git a/src/src/globals.h b/src/src/globals.h index 8b55321f9..3d4cd3981 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -160,7 +160,7 @@ extern uschar *acl_removed_headers; /* Headers deleted by an ACL */ extern uschar *acl_smtp_auth; /* ACL run for AUTH */ extern uschar *acl_smtp_connect; /* ACL run on SMTP connection */ extern uschar *acl_smtp_data; /* ACL run after DATA received */ -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR extern uschar *acl_smtp_data_prdr; /* ACL run after DATA received if in PRDR mode*/ const extern pcre *regex_PRDR; /* For recognizing PRDR settings */ #endif @@ -592,7 +592,7 @@ 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 */ -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR extern BOOL prdr_enable; /* As it says */ extern BOOL prdr_requested; /* Connecting mail server wants PRDR */ #endif diff --git a/src/src/macros.h b/src/src/macros.h index fc3776c84..53c0e3e27 100644 --- a/src/src/macros.h +++ b/src/src/macros.h @@ -826,7 +826,7 @@ enum { ACL_WHERE_RCPT, /* Some controls are for RCPT only */ ACL_WHERE_MIME, /* ) implemented by <= WHERE_NOTSMTP */ ACL_WHERE_DKIM, /* ) */ ACL_WHERE_DATA, /* ) */ -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR ACL_WHERE_PRDR, /* ) */ #endif ACL_WHERE_NOTSMTP, /* ) */ diff --git a/src/src/readconf.c b/src/src/readconf.c index f213b2c57..db1d766b0 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -140,7 +140,7 @@ static optionlist optionlist_config[] = { { "acl_smtp_auth", opt_stringptr, &acl_smtp_auth }, { "acl_smtp_connect", opt_stringptr, &acl_smtp_connect }, { "acl_smtp_data", opt_stringptr, &acl_smtp_data }, -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR { "acl_smtp_data_prdr", opt_stringptr, &acl_smtp_data_prdr }, #endif #ifndef DISABLE_DKIM @@ -324,7 +324,7 @@ static optionlist optionlist_config[] = { #endif { "pid_file_path", opt_stringptr, &pid_file_path }, { "pipelining_advertise_hosts", opt_stringptr, &pipelining_advertise_hosts }, -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR { "prdr_enable", opt_bool, &prdr_enable }, #endif { "preserve_message_logs", opt_bool, &preserve_message_logs }, diff --git a/src/src/receive.c b/src/src/receive.c index 407af58f8..af8e6de4c 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -519,7 +519,7 @@ Arguments: Returns: nothing */ -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR static void smtp_user_msg(uschar *code, uschar *user_msg) { @@ -3276,8 +3276,8 @@ else dmarc_up = dmarc_store_data(from_header); #endif /* EXPERIMENTAL_DMARC */ -#ifdef EXPERIMENTAL_PRDR - if (prdr_requested && recipients_count > 1 && acl_smtp_data_prdr != NULL ) +#ifndef DISABLE_PRDR + if (prdr_requested && recipients_count > 1 && acl_smtp_data_prdr) { unsigned int c; int all_pass = OK; @@ -3345,7 +3345,7 @@ else } else prdr_requested = FALSE; -#endif /* EXPERIMENTAL_PRDR */ +#endif /* !DISABLE_PRDR */ /* Check the recipients count again, as the MIME ACL might have changed them. */ @@ -3738,21 +3738,20 @@ if (message_reference != NULL) s = add_host_info_for_log(s, &size, &sptr); #ifdef SUPPORT_TLS -if ((log_extra_selector & LX_tls_cipher) != 0 && tls_in.cipher != NULL) +if (log_extra_selector & LX_tls_cipher && tls_in.cipher) s = string_append(s, &size, &sptr, 2, US" X=", tls_in.cipher); -if ((log_extra_selector & LX_tls_certificate_verified) != 0 && - tls_in.cipher != NULL) +if (log_extra_selector & LX_tls_certificate_verified && tls_in.cipher) s = string_append(s, &size, &sptr, 2, US" CV=", tls_in.certificate_verified? "yes":"no"); -if ((log_extra_selector & LX_tls_peerdn) != 0 && tls_in.peerdn != NULL) +if (log_extra_selector & LX_tls_peerdn && tls_in.peerdn) s = string_append(s, &size, &sptr, 3, US" DN=\"", string_printing(tls_in.peerdn), US"\""); -if ((log_extra_selector & LX_tls_sni) != 0 && tls_in.sni != NULL) +if (log_extra_selector & LX_tls_sni && tls_in.sni) s = string_append(s, &size, &sptr, 3, US" SNI=\"", string_printing(tls_in.sni), US"\""); #endif -if (sender_host_authenticated != NULL) +if (sender_host_authenticated) { s = string_append(s, &size, &sptr, 2, US" A=", sender_host_authenticated); if (authenticated_id != NULL) @@ -3763,16 +3762,14 @@ if (sender_host_authenticated != NULL) } } -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR if (prdr_requested) s = string_append(s, &size, &sptr, 1, US" PRDR"); #endif + #ifdef EXPERIMENTAL_PROXY -if (proxy_session && - (log_extra_selector & LX_proxy) != 0) - { +if (proxy_session && log_extra_selector & LX_proxy) s = string_append(s, &size, &sptr, 2, US" PRX=", proxy_host_address); - } #endif sprintf(CS big_buffer, "%d", msg_size); @@ -3990,11 +3987,11 @@ if(cutthrough_fd >= 0) } } -if(smtp_reply == NULL -#ifdef EXPERIMENTAL_PRDR - || prdr_requested +#ifndef DISABLE_PRDR +if(!smtp_reply || prdr_requested) +#else +if(!smtp_reply) #endif - ) { log_write(0, LOG_MAIN | (((log_extra_selector & LX_received_recipients) != 0)? LOG_RECIPIENTS : 0) | diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 82a805a21..aad778eef 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -214,7 +214,7 @@ static uschar *protocols[] = { /* Sanity check and validate optional args to MAIL FROM: envelope */ enum { ENV_MAIL_OPT_SIZE, ENV_MAIL_OPT_BODY, ENV_MAIL_OPT_AUTH, -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR ENV_MAIL_OPT_PRDR, #endif ENV_MAIL_OPT_NULL @@ -229,7 +229,7 @@ static env_mail_type_t env_mail_type_list[] = { { US"SIZE", ENV_MAIL_OPT_SIZE, TRUE }, { US"BODY", ENV_MAIL_OPT_BODY, TRUE }, { US"AUTH", ENV_MAIL_OPT_AUTH, TRUE }, -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR { US"PRDR", ENV_MAIL_OPT_PRDR, FALSE }, #endif { US"NULL", ENV_MAIL_OPT_NULL, FALSE } @@ -2637,7 +2637,7 @@ uschar *what = #endif (where == ACL_WHERE_PREDATA)? US"DATA" : (where == ACL_WHERE_DATA)? US"after DATA" : -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR (where == ACL_WHERE_PRDR)? US"after DATA PRDR" : #endif (smtp_cmd_data == NULL)? @@ -3628,12 +3628,13 @@ while (done <= 0) } #endif - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR /* Per Recipient Data Response, draft by Eric A. Hall extending RFC */ - if (prdr_enable) { + if (prdr_enable) + { s = string_cat(s, &size, &ptr, smtp_code, 3); s = string_cat(s, &size, &ptr, US"-PRDR\r\n", 7); - } + } #endif /* Finish off the multiline reply with one that is always available. */ @@ -3862,9 +3863,9 @@ while (done <= 0) } break; -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR case ENV_MAIL_OPT_PRDR: - if ( prdr_enable ) + if (prdr_enable) prdr_requested = TRUE; break; #endif @@ -3989,29 +3990,32 @@ while (done <= 0) when pipelining is not advertised, do another sync check in case the ACL delayed and the client started sending in the meantime. */ - if (acl_smtp_mail == NULL) rc = OK; else + if (acl_smtp_mail) { rc = acl_check(ACL_WHERE_MAIL, NULL, acl_smtp_mail, &user_msg, &log_msg); if (rc == OK && !pipelining_advertised && !check_sync()) goto SYNC_FAILURE; } + else + rc = OK; if (rc == OK || rc == DISCARD) { - if (user_msg == NULL) + if (!user_msg) smtp_printf("%s%s%s", US"250 OK", - #ifdef EXPERIMENTAL_PRDR - prdr_requested == TRUE ? US", PRDR Requested" : - #endif + #ifndef DISABLE_PRDR + prdr_requested ? US", PRDR Requested" : US"", + #else US"", + #endif US"\r\n"); else { - #ifdef EXPERIMENTAL_PRDR - if ( prdr_requested == TRUE ) + #ifndef DISABLE_PRDR + if (prdr_requested) user_msg = string_sprintf("%s%s", user_msg, US", PRDR Requested"); #endif - smtp_user_msg(US"250",user_msg); + smtp_user_msg(US"250", user_msg); } smtp_delay_rcpt = smtp_rlr_base; recipients_discarded = (rc == DISCARD); diff --git a/src/src/structs.h b/src/src/structs.h index 989653e30..a9edb4670 100644 --- a/src/src/structs.h +++ b/src/src/structs.h @@ -488,7 +488,7 @@ typedef struct address_item_propagated { #define af_cert_verified 0x01000000 /* delivered with verified TLS cert */ #define af_pass_message 0x02000000 /* pass message in bounces */ #define af_bad_reply 0x04000000 /* filter could not generate autoreply */ -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR # define af_prdr_used 0x08000000 /* delivery used SMTP PRDR */ #endif #define af_force_command 0x10000000 /* force_command in pipe transport */ diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 020f76cac..71a9f2376 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -118,7 +118,7 @@ optionlist smtp_transport_options[] = { #endif { "hosts_try_auth", opt_stringptr, (void *)offsetof(smtp_transport_options_block, hosts_try_auth) }, -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR { "hosts_try_prdr", opt_stringptr, (void *)offsetof(smtp_transport_options_block, hosts_try_prdr) }, #endif @@ -196,7 +196,7 @@ smtp_transport_options_block smtp_transport_option_defaults = { NULL, /* serialize_hosts */ NULL, /* hosts_try_auth */ NULL, /* hosts_require_auth */ -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR NULL, /* hosts_try_prdr */ #endif #ifdef EXPERIMENTAL_OCSP @@ -1185,7 +1185,7 @@ BOOL completed_address = FALSE; BOOL esmtp = TRUE; BOOL pending_MAIL; BOOL pass_message = FALSE; -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR BOOL prdr_offered = FALSE; BOOL prdr_active; #endif @@ -1386,7 +1386,7 @@ goto SEND_QUIT; PCRE_EOPT, NULL, 0) >= 0; #endif - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR prdr_offered = esmtp && (pcre_exec(regex_PRDR, NULL, CS buffer, Ustrlen(buffer), 0, PCRE_EOPT, NULL, 0) >= 0) && @@ -1585,7 +1585,7 @@ if (continue_hostname == NULL DEBUG(D_transport) debug_printf("%susing PIPELINING\n", smtp_use_pipelining? "" : "not "); -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR prdr_offered = esmtp && pcre_exec(regex_PRDR, NULL, CS buffer, Ustrlen(CS buffer), 0, PCRE_EOPT, NULL, 0) >= 0 && @@ -1673,7 +1673,7 @@ if (smtp_use_size) while (*p) p++; } -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR prdr_active = FALSE; if (prdr_offered) { @@ -1909,7 +1909,7 @@ if (!ok) ok = TRUE; else smtp_command = US"end of data"; -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR /* For PRDR we optionally get a partial-responses warning * followed by the individual responses, before going on with * the overall response. If we don't get the warning then deal @@ -2004,7 +2004,7 @@ if (!ok) ok = TRUE; else address. For temporary errors, add a retry item for the address so that it doesn't get tried again too soon. */ -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR if (lmtp || prdr_active) #else if (lmtp) @@ -2015,7 +2015,7 @@ if (!ok) ok = TRUE; else { if (errno != 0 || buffer[0] == 0) goto RESPONSE_FAILED; addr->message = string_sprintf( -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR "%s error after %s: %s", prdr_active ? "PRDR":"LMTP", #else "LMTP error after %s: %s", @@ -2029,7 +2029,7 @@ if (!ok) ok = TRUE; else errno = ERRNO_DATA4XX; addr->more_errno |= ((buffer[1] - '0')*10 + buffer[2] - '0') << 8; addr->transport_return = DEFER; -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR if (!prdr_active) #endif retry_add_item(addr, addr->address_retry_key, 0); @@ -2052,12 +2052,12 @@ if (!ok) ok = TRUE; else addr->host_used = thost; addr->special_action = flag; addr->message = conf; -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR if (prdr_active) addr->flags |= af_prdr_used; #endif flag = '-'; -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR if (!prdr_active) #endif { @@ -2079,7 +2079,7 @@ if (!ok) ok = TRUE; else } } -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR if (prdr_active) { /* PRDR - get the final, overall response. For any non-success diff --git a/src/src/transports/smtp.h b/src/src/transports/smtp.h index 900542564..c7de0091a 100644 --- a/src/src/transports/smtp.h +++ b/src/src/transports/smtp.h @@ -21,7 +21,7 @@ typedef struct { uschar *serialize_hosts; uschar *hosts_try_auth; uschar *hosts_require_auth; -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR uschar *hosts_try_prdr; #endif #ifdef EXPERIMENTAL_OCSP -- cgit v1.2.3