Per-sender recipients blocklist

Дмитрий Матросов via Exim-users <[email protected]>
Newsgroups gmane.mail.exim.user
Message-ID <[email protected]>
Hi.

I'm trying to implement per-sender recipients blocklist. In 
'acl_smtp_rcpt'
everything was quite simple:

         deny
             authenticated = *
             recipients = <, ${lookup {$sender_address} 
nwildlsearch{EXIM_DIR/recipients_blacklist}}
             message = Rejected by recipients blacklist

but for 'acl_not_smtp' such solution does not work. It's
tempting to do something like:

         discard
             set acl_m_recipients_blacklist = ${lookup {$sender_address} 
lsearch{EXIM_DIR/recipients_blacklist}}
             condition = ${if forany {<, $recipients} {match_address 
{$item}{<, $acl_m_recipients_blacklist}}}
             message = Rejected by recipients blacklist

but it doesn't work, because 'match_address' does not expand its second
argument. Neither does nested 'forany', because external '$item' is
overwritten and i don't have $item2:

             condition = ${if forany {<, $recipients} {
                                forany {<, $acl_m_recipients_blacklist}
                                    {match {$item}{$item2}}
                              }
                          }

The only working variant, which i can think of, is defining addresslist
externally and then using match_address on it, like:

         addresslist recipients_blacklist = <, ${lookup {$sender_address} 
lsearch{EXIM_DIR/recipients_blacklist}}
         acl_not_smtp = acl_check_not_smtp
         begin acl
             acl_check_not_smtp:
                 discard
                     condition = ${if forany {<, $recipients} 
{match_address {$item}{+recipients_blacklist}}}
                     message = Rejected by recipients blacklist

And indeed it works.

So, i have two questions:
- What is idiomatic way of searching an address in a list obtained from 
a lookup?
   (acl_smtp_rcpt case)
- And what is idiomatic way of checking whether any address (item?) from 
one list
   ($recipients) is part of the another (i.e. implementing nested loop
   essentially)? (acl_not_smtp case)

Thanks.

-- 
## subscription configuration (requires account):
##   https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
##   [email protected]
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.