From 05caaeaae58a10357a29082c288dccdcd85e8ee4 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Thu, 8 Nov 2012 00:37:32 +0000 Subject: [PATCH] Ensure that recipient is well-defined for expansion-called acl at RCPT-time. --- src/src/acl.c | 16 ++++++---------- src/src/expand.c | 2 +- src/src/functions.h | 2 +- test/confs/0027 | 1 + 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/src/acl.c b/src/src/acl.c index c1eebf655..a862277a5 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -4008,8 +4008,7 @@ return search_find_defer?DEFER:ERROR; /* Alternate interface for ACL, used by expansions */ int -acl_eval(int where, uschar *recipient, uschar *s, uschar **user_msgptr, - uschar **log_msgptr) +acl_eval(int where, uschar *s, uschar **user_msgptr, uschar **log_msgptr) { int rc; address_item adb; @@ -4024,14 +4023,11 @@ if (where == ACL_WHERE_RCPT) { adb = address_defaults; addr = &adb; - addr->address = recipient; - if (deliver_split_address(addr) == DEFER) - { - *log_msgptr = US"defer in percent_hack_domains check"; - return DEFER; - } - deliver_domain = addr->domain; - deliver_localpart = addr->local_part; + addr->address = expand_string(US"$local_part@$domain"); + addr->domain = deliver_domain; + addr->local_part = deliver_localpart; + addr->cc_local_part = deliver_localpart; + addr->lc_local_part = deliver_localpart; } return acl_check_internal(where, addr, s, 0, user_msgptr, log_msgptr); diff --git a/src/src/expand.c b/src/src/expand.c index 786d4279c..9fc00cf41 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1891,7 +1891,7 @@ DEBUG(D_expand) acl_narg>0 ? sub[1] : US"", acl_narg>1 ? " +more" : ""); -ret = acl_eval(acl_where, NULL, sub[0], user_msgp, &tmp); +ret = acl_eval(acl_where, sub[0], user_msgp, &tmp); for (i = 0; i < nsub; i++) acl_arg[i] = sub[i+1]; /* restore old args */ diff --git a/src/src/functions.h b/src/src/functions.h index d6f4f68fd..174db07eb 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -49,7 +49,7 @@ extern BOOL tls_openssl_options_parse(uschar *, long *); extern acl_block *acl_read(uschar *(*)(void), uschar **); extern int acl_check(int, uschar *, uschar *, uschar **, uschar **); -extern int acl_eval(int, uschar *, uschar *, uschar **, uschar **); +extern int acl_eval(int, uschar *, uschar **, uschar **); extern tree_node *acl_var_create(uschar *); extern void acl_var_write(uschar *, uschar *, void *); diff --git a/test/confs/0027 b/test/confs/0027 index 75ccf4ae6..8fe398b47 100644 --- a/test/confs/0027 +++ b/test/confs/0027 @@ -42,6 +42,7 @@ data3: accept local_parts = a.b.c acl_rcpt: + warn set acl_m_1 = ${acl {data}} accept endpass acl = ${tr{$local_part}{:}{\n}} deny message = this message should not occur -- 2.30.2