From 858e91c21a3a14da760299b6d54676ac18526418 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Tue, 3 Nov 2015 14:40:56 +0000 Subject: [PATCH] PRDR: Introduce $prdr_requested flag variable. Bug 1712 --- doc/doc-docbook/spec.xfpt | 15 +++++++++++++-- doc/doc-txt/ChangeLog | 5 +++++ src/src/expand.c | 3 +++ test/confs/5500 | 10 ++++------ test/log/5500 | 9 +++++++++ test/mail/5500.userx | 8 ++++++++ test/scripts/5500-PRDR/5500 | 34 +++++++++++++++++++++++++++++----- test/stdout/5500 | 33 +++++++++++++++++++++++++++++++++ 8 files changed, 104 insertions(+), 13 deletions(-) diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 5254fb8a2..b0b1585fe 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -11989,6 +11989,13 @@ a single-component name, Exim calls &[gethostbyname()]& (or qualified host name. See also &$smtp_active_hostname$&. +.new +.vitem &$prdr_requested$& +.cindex "PRDR" "variable for" +This variable is set to &"yes"& if PRDR was requested by the client for the +current message, otherwise &"no"&. +.wen + .vitem &$prvscheck_address$& This variable is used in conjunction with the &%prvscheck%& expansion item, which is described in sections &<>& and @@ -27393,8 +27400,12 @@ 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 +.new +.cindex "PRDR" "variable for" +for this can be disabled when the variable &$prdr_requested$& +is &"yes"&. +.wen +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 (e.g. single-recipient mails). diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index cea29eeb3..4e5663fab 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -68,6 +68,11 @@ JH/12 Bug 1706: percent and underbar characters are no longer escaped by the JH/13 Bug 1708: avoid misaligned access in cached lookup. +JH/14 Change header file name for freeradius-client. Relevant if compiling + with Radius support; from the Gentoo tree and checked under Fedora. + +JH/15 Bug 1712: Introduce $prdr_requested flag variable + Exim version 4.86 ----------------- diff --git a/src/src/expand.c b/src/src/expand.c index 2c3c8a4a5..fbbc68154 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -606,6 +606,9 @@ static var_entry var_table[] = { { "parent_domain", vtype_stringptr, &deliver_domain_parent }, { "parent_local_part", vtype_stringptr, &deliver_localpart_parent }, { "pid", vtype_pid, NULL }, +#ifndef DISABLE_PRDR + { "prdr_requested", vtype_bool, &prdr_requested }, +#endif { "primary_hostname", vtype_stringptr, &primary_hostname }, #ifdef EXPERIMENTAL_PROXY { "proxy_host_address", vtype_stringptr, &proxy_host_address }, diff --git a/test/confs/5500 b/test/confs/5500 index 6b9e328ba..bbdd696f9 100644 --- a/test/confs/5500 +++ b/test/confs/5500 @@ -22,6 +22,7 @@ trusted_users = CALLER prdr_enable = true +acl_smtp_mail = mail_acl acl_smtp_rcpt = accept acl_smtp_data_prdr = prdr_acl acl_smtp_data = data_acl @@ -30,6 +31,9 @@ acl_smtp_data = data_acl begin acl +mail_acl: + accept logwrite = prdr_requested: <$prdr_requested> + prdr_acl: defer local_parts = usery deny local_parts = userz @@ -56,10 +60,4 @@ r0: driver = accept transport = t1 -# ----- Retry ----- - -begin retry - -* * F,5d,5m - # End diff --git a/test/log/5500 b/test/log/5500 index ef5372cd1..997a32e31 100644 --- a/test/log/5500 +++ b/test/log/5500 @@ -1,17 +1,26 @@ 1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225 +1999-03-02 09:44:33 prdr_requested: 1999-03-02 09:44:33 10HmaY-0005vi-00 PRDR R= acceptance 1999-03-02 09:44:33 10HmaY-0005vi-00 PRDR R= temporary refusal 1999-03-02 09:44:33 10HmaY-0005vi-00 PRDR R= refusal 1999-03-02 09:44:33 10HmaY-0005vi-00 <= <> H=(rhu.barb) [127.0.0.1] P=esmtp PRDR S=sss 1999-03-02 09:44:33 10HmaY-0005vi-00 => userx R=r0 T=t1 1999-03-02 09:44:33 10HmaY-0005vi-00 Completed +1999-03-02 09:44:33 prdr_requested: 1999-03-02 09:44:33 10HmaX-0005vi-00 PRDR R= acceptance 1999-03-02 09:44:33 10HmaX-0005vi-00 PRDR R= acceptance 1999-03-02 09:44:33 10HmaX-0005vi-00 H=(rhu.barb) [127.0.0.1] F=<> rejected after DATA +1999-03-02 09:44:33 prdr_requested: 1999-03-02 09:44:33 10HmaZ-0005vi-00 <= <> H=(rhu.barb) [127.0.0.1] P=esmtp S=sss 1999-03-02 09:44:33 10HmaZ-0005vi-00 => user1 R=r0 T=t1 1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed +1999-03-02 09:44:33 prdr_requested: 1999-03-02 09:44:33 10HmbA-0005vi-00 PRDR R= temporary refusal 1999-03-02 09:44:33 10HmbA-0005vi-00 PRDR R= temporary refusal +1999-03-02 09:44:33 prdr_requested: 1999-03-02 09:44:33 10HmbB-0005vi-00 PRDR R= refusal 1999-03-02 09:44:33 10HmbB-0005vi-00 PRDR R= refusal +1999-03-02 09:44:33 prdr_requested: +1999-03-02 09:44:33 10HmbC-0005vi-00 <= <> H=(rhu.barb) [127.0.0.1] P=esmtp S=sss +1999-03-02 09:44:33 10HmbC-0005vi-00 => userx R=r0 T=t1 +1999-03-02 09:44:33 10HmbC-0005vi-00 Completed diff --git a/test/mail/5500.userx b/test/mail/5500.userx index c46897f8d..59fd89bba 100644 --- a/test/mail/5500.userx +++ b/test/mail/5500.userx @@ -5,3 +5,11 @@ Received: from [127.0.0.1] (helo=rhu.barb) Sender: sender@some.where +From MAILER-DAEMON Tue Mar 02 09:44:33 1999 +Received: from [127.0.0.1] (helo=rhu.barb) + by myhost.test.ex with esmtp (Exim x.yz) + id 10HmbC-0005vi-00 + for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000 +Sender: sender@some.where + + diff --git a/test/scripts/5500-PRDR/5500 b/test/scripts/5500-PRDR/5500 index 567b00085..1c6c344fe 100644 --- a/test/scripts/5500-PRDR/5500 +++ b/test/scripts/5500-PRDR/5500 @@ -35,7 +35,7 @@ Sender: sender@some.where quit ??? 221 **** -sleep 1 +millisleep 500 # # # 2: traditional data acl should be called, resulting in an overall reject @@ -65,7 +65,7 @@ Sender: sender@some.where quit ??? 221 **** -sleep 1 +millisleep 500 # # # 3: PRDR should be avoided for a single-recipient message @@ -91,7 +91,7 @@ Sender: sender@some.where quit ??? 221 **** -sleep 1 +millisleep 500 # # 4: double temp-reject client 127.0.0.1 PORT_D @@ -120,7 +120,7 @@ Sender: sender@some.where quit ??? 221 **** -sleep 1 +millisleep 500 # # 5: double reject client 127.0.0.1 PORT_D @@ -149,7 +149,31 @@ Sender: sender@some.where quit ??? 221 **** -sleep 1 +millisleep 500 +# +# 6: no PRDR request +client 127.0.0.1 PORT_D +??? 220 +ehlo rhu.barb +??? 250- +??? 250- +??? 250- +??? 250- +??? 250-PRDR +??? 250 +mail from:<> +??? 250 +rcpt to: +??? 250 +data +??? 354 +Sender: sender@some.where +. +??? 250 +quit +??? 221 +**** +millisleep 500 # killdaemon # diff --git a/test/stdout/5500 b/test/stdout/5500 index d5efef741..37294c24b 100644 --- a/test/stdout/5500 +++ b/test/stdout/5500 @@ -204,3 +204,36 @@ Connecting to 127.0.0.1 port 1225 ... connected ??? 221 <<< 221 myhost.test.ex closing connection End of script +Connecting to 127.0.0.1 port 1225 ... connected +??? 220 +<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 +>>> ehlo rhu.barb +??? 250- +<<< 250-myhost.test.ex Hello rhu.barb [127.0.0.1] +??? 250- +<<< 250-SIZE 52428800 +??? 250- +<<< 250-8BITMIME +??? 250- +<<< 250-PIPELINING +??? 250-PRDR +<<< 250-PRDR +??? 250 +<<< 250 HELP +>>> mail from:<> +??? 250 +<<< 250 OK +>>> rcpt to: +??? 250 +<<< 250 Accepted +>>> data +??? 354 +<<< 354 Enter message, ending with "." on a line by itself +>>> Sender: sender@some.where +>>> . +??? 250 +<<< 250 OK id=10HmbC-0005vi-00 +>>> quit +??? 221 +<<< 221 myhost.test.ex closing connection +End of script -- 2.25.1