diff options
-rw-r--r-- | doc/doc-docbook/spec.xfpt | 63 | ||||
-rw-r--r-- | doc/doc-txt/ChangeLog | 2 | ||||
-rw-r--r-- | doc/doc-txt/NewStuff | 2 | ||||
-rw-r--r-- | doc/doc-txt/experimental-spec.txt | 28 | ||||
-rw-r--r-- | src/src/EDITME | 6 | ||||
-rw-r--r-- | src/src/acl.c | 44 | ||||
-rw-r--r-- | src/src/deliver.c | 9 | ||||
-rw-r--r-- | src/src/exim.c | 3 | ||||
-rw-r--r-- | src/src/globals.c | 8 | ||||
-rw-r--r-- | src/src/globals.h | 4 | ||||
-rw-r--r-- | src/src/macros.h | 2 | ||||
-rw-r--r-- | src/src/readconf.c | 4 | ||||
-rw-r--r-- | src/src/receive.c | 35 | ||||
-rw-r--r-- | src/src/smtp_in.c | 36 | ||||
-rw-r--r-- | src/src/structs.h | 2 | ||||
-rw-r--r-- | src/src/transports/smtp.c | 26 | ||||
-rw-r--r-- | src/src/transports/smtp.h | 2 | ||||
-rw-r--r-- | test/scripts/5500-PRDR/REQUIRES | 1 |
18 files changed, 156 insertions, 121 deletions
diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index cbe5c1851..7c34bbbc7 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -13135,6 +13135,7 @@ listed in more than one group. .row &%acl_smtp_auth%& "ACL for AUTH" .row &%acl_smtp_connect%& "ACL for connection" .row &%acl_smtp_data%& "ACL for DATA" +.row &%acl_smtp_data_prdr%& "ACL for DATA, per-recipient" .row &%acl_smtp_dkim%& "ACL for DKIM verification" .row &%acl_smtp_etrn%& "ACL for ETRN" .row &%acl_smtp_expn%& "ACL for EXPN" @@ -13290,6 +13291,7 @@ See also the &'Policy controls'& section above. .row &%ignore_fromline_hosts%& "allow &""From ""& from these hosts" .row &%ignore_fromline_local%& "allow &""From ""& from local SMTP" .row &%pipelining_advertise_hosts%& "advertise pipelining to these hosts" +.row &%prdr_enable%& "advertise PRDR to all hosts" .row &%tls_advertise_hosts%& "advertise TLS to these hosts" .endtable @@ -13441,6 +13443,16 @@ This option defines the ACL that is run after an SMTP DATA command has been processed and the message itself has been received, but before the final acknowledgment is sent. See chapter &<<CHAPACL>>& for further details. +.option acl_smtp_data_prdr main string&!! unset +.cindex "DATA" "ACL for" +.cindex "&ACL;" "PRDR-related" +.cindex "&ACL;" "per-user data processing" +This option defines the ACL that, +if the PRDR feature has been negotiated, +is run for each recipient after an SMTP DATA command has been +processed and the message itself has been received, but before the +acknowledgment is sent. See chapter &<<CHAPACL>>& for further details. + .option acl_smtp_etrn main string&!! unset .cindex "ETRN" "ACL for" This option defines the ACL that is run when an SMTP ETRN command is @@ -15083,6 +15095,15 @@ that clients will use it; &"out of order"& commands that are &"expected"& do not count as protocol errors (see &%smtp_max_synprot_errors%&). +.option prdr_enable main boolean false +.cindex "PRDR" "enabling on server" +This option can be used to enable the Per-Recipient Data Response extension +to SMTP, defined by Eric Hall. +If the option is set, PRDR is advertised by Exim when operating as a server. +If the client requests PRDR, and more than one recipient, for a message +an additional ACL is called for each recipient after the message content +is recieved. See section &<<SECTPRDRACL>>&. + .option preserve_message_logs main boolean false .cindex "message logs" "preserving" If this option is set, message log files are not deleted when messages are @@ -22973,6 +22994,12 @@ connects. If authentication fails, Exim will try to transfer the message unauthenticated. See also &%hosts_require_auth%&, and chapter &<<CHAPSMTPAUTH>>& for details of authentication. +.option hosts_try_prdr smtp "host list&!!" unset +.cindex "PRDR" "enabling, optional in client" +This option provides a list of servers to which, provided they announce +PRDR support, Exim will attempt to negotiate PRDR +for multi-recipient messages. + .option interface smtp "string list&!!" unset .cindex "bind IP address" .cindex "IP address" "binding" @@ -26460,6 +26487,7 @@ options in the main part of the configuration. These options are: .cindex "SMTP" "connection, ACL for" .cindex "non-SMTP messages" "ACLs for" .cindex "MIME content scanning" "ACL for" +.cindex "PRDR" "ACL for" .table2 140pt .irow &%acl_not_smtp%& "ACL for non-SMTP messages" @@ -26468,6 +26496,7 @@ options in the main part of the configuration. These options are: .irow &%acl_smtp_auth%& "ACL for AUTH" .irow &%acl_smtp_connect%& "ACL for start of SMTP connection" .irow &%acl_smtp_data%& "ACL after DATA is complete" +.irow &%acl_smtp_data_prdr%& "ACL for each recipient, after DATA is complete" .irow &%acl_smtp_etrn%& "ACL for ETRN" .irow &%acl_smtp_expn%& "ACL for EXPN" .irow &%acl_smtp_helo%& "ACL for HELO or EHLO" @@ -26582,8 +26611,10 @@ before or after the data) correctly &-- they keep the message on their queues and try again later, but that is their problem, though it does waste some of your resources. -The &%acl_smtp_data%& ACL is run after both the &%acl_smtp_dkim%& and -the &%acl_smtp_mime%& ACLs. +The &%acl_smtp_data%& ACL is run after +the &%acl_smtp_data_prdr%&, +the &%acl_smtp_dkim%& +and the &%acl_smtp_mime%& ACLs. .section "The SMTP DKIM ACL" "SECTDKIMACL" The &%acl_smtp_dkim%& ACL is available only when Exim is compiled with DKIM support @@ -26605,6 +26636,34 @@ content-scanning extension. For details, see chapter &<<CHAPexiscan>>&. This ACL is evaluated after &%acl_smtp_dkim%& but before &%acl_smtp_data%&. +.section "The SMTP PRDR ACL" "SECTPRDRACL" +.oindex "&%prdr_enable%&" +The &%acl_smtp_data_prdr%& ACL is available only when Exim is compiled +with PRDR support enabled (which is the default). +It becomes active only when the PRDR feature is negotiated between +client and server for a message, and more than one recipient +has been accepted. + +The ACL test specfied by &%acl_smtp_data_prdr%& happens after a message +has been recieved, and is executed for each recipient of the message. +The test may accept or deny for inividual recipients. +The &%acl_smtp_data%& will still be called after this ACL and +can reject the message overall, even if this ACL has accepted it +for some or all recipients. + +PRDR may be used to support per-user content filtering. Without it +one must defer any recipient after the first that has a different +content-filter configuration. With PRDR, the RCPT-time check +for this can be disabled when the MAIL-time $smtp_command included +"PRDR". Any required difference in behaviour of the main DATA-time +ACL should however depend on the PRDR-time ACL having run, as Exim +will avoid doing so in some situations (eg. single-recipient mails). + +See also the &%prdr_enable%& global option +and the &%hosts_try_prdr%& smtp transport option. + +This ACL is evaluated after &%acl_smtp_dkim%& but before &%acl_smtp_data%&. + .section "The QUIT ACL" "SECTQUITACL" .cindex "QUIT, ACL for" The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 33e43b196..276876fe6 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -115,6 +115,8 @@ JH/22 Expansion operators ${md5:string} and ${sha1::string} can now operate on certificate variables to give certificate fingerprints Also new ${sha256:cert_variable}. +JH/23 The PRDR feature is moved from being Experimental into the mainline. + Exim version 4.82 ----------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 9eebd089f..ac06ebfc6 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -49,6 +49,8 @@ Version 4.83 work over them for generating fingerprints, and a new sha256 operator for them added. +11. PRDR is now supported dy default. + Version 4.82 ------------ diff --git a/doc/doc-txt/experimental-spec.txt b/doc/doc-txt/experimental-spec.txt index 1ec323433..018bfddb9 100644 --- a/doc/doc-txt/experimental-spec.txt +++ b/doc/doc-txt/experimental-spec.txt @@ -6,34 +6,6 @@ about experimental features, all of which are unstable and liable to incompatible change. -PRDR support --------------------------------------------------------------- - -Per-Recipient Data Reponse is an SMTP extension proposed by Eric Hall -in a (now-expired) IETF draft from 2007. It's not hit mainstream -use, but has apparently been implemented in the META1 MTA. - -There is mention at http://mail.aegee.org/intern/sendmail.html -of a patch to sendmail "to make it PRDR capable". - - ref: http://www.eric-a-hall.com/specs/draft-hall-prdr-00.txt - -If Exim is built with EXPERIMENTAL_PRDR there is a new config -boolean "prdr_enable" which controls whether PRDR is advertised -as part of an EHLO response, a new "acl_data_smtp_prdr" ACL -(called for each recipient, after data arrives but before the -data ACL), and a new smtp transport option "hosts_try_prdr". - -PRDR may be used to support per-user content filtering. Without it -one must defer any recipient after the first that has a different -content-filter configuration. With PRDR, the RCPT-time check -for this can be disabled when the MAIL-time $smtp_command included -"PRDR". Any required difference in behaviour of the main DATA-time -ACL should however depend on the PRDR-time ACL having run, as Exim -will avoid doing so in some situations (eg. single-recipient mails). - - - OCSP Stapling support -------------------------------------------------------------- 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<<ACL_WHERE_MAIL)|(1<<ACL_WHERE_RCPT)| /* add_header */ (1<<ACL_WHERE_PREDATA)|(1<<ACL_WHERE_DATA)| - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR (1<<ACL_WHERE_PRDR)| #endif (1<<ACL_WHERE_MIME)|(1<<ACL_WHERE_NOTSMTP)| @@ -412,7 +412,7 @@ static unsigned int cond_forbids[] = { (1<<ACL_WHERE_AUTH)| /* bmi_optin */ (1<<ACL_WHERE_CONNECT)|(1<<ACL_WHERE_HELO)| (1<<ACL_WHERE_DATA)|(1<<ACL_WHERE_MIME)| - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR (1<<ACL_WHERE_PRDR)| #endif (1<<ACL_WHERE_ETRN)|(1<<ACL_WHERE_EXPN)| @@ -434,9 +434,9 @@ static unsigned int cond_forbids[] = { #ifdef EXPERIMENTAL_DCC (unsigned int) ~((1<<ACL_WHERE_DATA)| /* dcc */ - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR (1<<ACL_WHERE_PRDR)| - #endif /* EXPERIMENTAL_PRDR */ + #endif (1<<ACL_WHERE_NOTSMTP)), #endif @@ -450,9 +450,9 @@ static unsigned int cond_forbids[] = { #ifdef WITH_OLD_DEMIME (unsigned int) ~((1<<ACL_WHERE_DATA)| /* demime */ - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR (1<<ACL_WHERE_PRDR)| - #endif /* EXPERIMENTAL_PRDR */ + #endif (1<<ACL_WHERE_NOTSMTP)), #endif @@ -474,7 +474,7 @@ static unsigned int cond_forbids[] = { (unsigned int) ~((1<<ACL_WHERE_RCPT) /* domains */ - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR |(1<<ACL_WHERE_PRDR) #endif ), @@ -505,9 +505,9 @@ static unsigned int cond_forbids[] = { #ifdef WITH_CONTENT_SCAN (unsigned int) ~((1<<ACL_WHERE_DATA)| /* malware */ - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR (1<<ACL_WHERE_PRDR)| - #endif /* EXPERIMENTAL_PRDR */ + #endif (1<<ACL_WHERE_NOTSMTP)), #endif @@ -526,9 +526,9 @@ static unsigned int cond_forbids[] = { #ifdef WITH_CONTENT_SCAN (unsigned int) ~((1<<ACL_WHERE_DATA)| /* regex */ - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR (1<<ACL_WHERE_PRDR)| - #endif /* EXPERIMENTAL_PRDR */ + #endif (1<<ACL_WHERE_NOTSMTP)| (1<<ACL_WHERE_MIME)), #endif @@ -536,7 +536,7 @@ static unsigned int cond_forbids[] = { (unsigned int) ~((1<<ACL_WHERE_MAIL)|(1<<ACL_WHERE_RCPT)| /* remove_header */ (1<<ACL_WHERE_PREDATA)|(1<<ACL_WHERE_DATA)| - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR (1<<ACL_WHERE_PRDR)| #endif (1<<ACL_WHERE_MIME)|(1<<ACL_WHERE_NOTSMTP)| @@ -559,9 +559,9 @@ static unsigned int cond_forbids[] = { #ifdef WITH_CONTENT_SCAN (unsigned int) ~((1<<ACL_WHERE_DATA)| /* spam */ - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR (1<<ACL_WHERE_PRDR)| - #endif /* EXPERIMENTAL_PRDR */ + #endif (1<<ACL_WHERE_NOTSMTP)), #endif @@ -608,9 +608,9 @@ static unsigned int control_forbids[] = { #ifndef DISABLE_DKIM (1<<ACL_WHERE_DATA)|(1<<ACL_WHERE_NOTSMTP)| /* dkim_disable_verify */ - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR (1<<ACL_WHERE_PRDR)| - #endif /* EXPERIMENTAL_PRDR */ + #endif (1<<ACL_WHERE_NOTSMTP_START), #endif @@ -674,17 +674,17 @@ static unsigned int control_forbids[] = { (unsigned int) ~((1<<ACL_WHERE_MAIL)|(1<<ACL_WHERE_RCPT)| /* fakedefer */ (1<<ACL_WHERE_PREDATA)|(1<<ACL_WHERE_DATA)| - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR (1<<ACL_WHERE_PRDR)| - #endif /* EXPERIMENTAL_PRDR */ + #endif (1<<ACL_WHERE_MIME)), (unsigned int) ~((1<<ACL_WHERE_MAIL)|(1<<ACL_WHERE_RCPT)| /* fakereject */ (1<<ACL_WHERE_PREDATA)|(1<<ACL_WHERE_DATA)| - #ifdef EXPERIMENTAL_PRDR + #ifndef DISABLE_PRDR (1<<ACL_WHERE_PRDR)| - #endif /* EXPERIMENTAL_PRDR */ + #endif (1<<ACL_WHERE_MIME)), (1<<ACL_WHERE_NOTSMTP)| /* no_multiline */ @@ -4319,7 +4319,7 @@ sender_verified_failed = NULL; ratelimiters_cmd = NULL; log_reject_target = LOG_MAIN|LOG_REJECT; -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR if (where == ACL_WHERE_RCPT || where == ACL_WHERE_PRDR ) #else if (where == ACL_WHERE_RCPT ) @@ -4363,7 +4363,7 @@ If conn-failure, no action (and keep the spooled copy). switch (where) { case ACL_WHERE_RCPT: -#ifdef EXPERIMENTAL_PRDR +#ifndef DISABLE_PRDR case ACL_WHERE_PRDR: #endif if( rcpt_count > 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 diff --git a/test/scripts/5500-PRDR/REQUIRES b/test/scripts/5500-PRDR/REQUIRES index b3c99396a..e69de29bb 100644 --- a/test/scripts/5500-PRDR/REQUIRES +++ b/test/scripts/5500-PRDR/REQUIRES @@ -1 +0,0 @@ -support Experimental_PRDR |