[exim] de-tainting

Top Page
Delete this message
Reply to this message
Author: Evgeniy Berdnikov
Date:  
To: exim-users
Subject: [exim] de-tainting
Hello.

The $domain_data variable is described in ch.9 of documentation with
statement

| $domain_data is also set when the domains condition in an ACL matches
| a domain by means of a lookup. The data read by the lookup is available
| during the rest of the ACL statement. In all other situations, this
| variable expands to nothing.


Well, I tried with ACL

test_domain_data:
  warn
    logwrite    = before lookup domain=\"$domain\" domain_data=\"$domain_data\"
#    domains    = dsearch,filter=dir;/etc/exim4/cust.d/tables
    domains     = lsearch;/etc/exim4/cust.d/domains.list
    logwrite    = after lookup domain=\"$domain\" domain_data=\"$domain_data\"


and file domains.list contains several strings, including "xxample.ru:"
(real domain name was hidden). When I run with debug, it results in:

>>> processing "warn" (/var/lib/exim4/config.autogenerated 485)
>>> check acl = test_domain_data
>>>  using ACL "test_domain_data"
>>>  processing "warn" (/var/lib/exim4/config.autogenerated 490)
>>>  check logwrite = before lookup domain=\"$domain\" domain_data=\"$domain_data\"
>>>                = before lookup domain="xxample.ru" domain_data=""

LOG: 287 [313687] before lookup domain="xxample.ru" domain_data=""
>>>  check domains = lsearch;/etc/exim4/cust.d/domains.list
>>> xxample.ru in "lsearch;/etc/exim4/cust.d/domains.list"? yes (matched "lsearch;/etc/exim4/cust.d/domains.list")
>>>  check logwrite = after lookup domain=\"$domain\" domain_data=\"$domain_data\"
>>>                = after lookup domain="xxample.ru" domain_data=""

LOG: 287 [313687] after lookup domain="xxample.ru" domain_data=""

So, lookup succeeds, but $domain_data is not set.

If I comment out 'lsearch' and restore 'dsearch' in ACL above, lookup succeeds
and $domain_data is filled by domain name -- as expected.

I run "Exim version 4.94 #2 built 19-Jun-2020 08:31:26" from Debian.
The question is: do I misunderstand documentaion in the point that ANY
lookup type should fill $domain_data, or some lookup types (such as dsearch)
differ from others in this aspect?
--
Eugene Berdnikov