Re: Using a dsearch lookup to untaint data

Jeremy Harris via Exim-users <[email protected]> Thu, 11 Dec 2025 21:29:27 +0000
Newsgroups gmane.mail.exim.user
Message-ID <[email protected]>
On 2025/12/11 8:56 PM, Johnnie Adams via Exim-users wrote:
>       Is it possible to write a lookup for an [email protected] and
> untaint the local part depending on a file foo.txt existing in a given
> directory?

You're making life difficult with that ".txt" element,

Assuming you want this in a router,
something along the lines of

address_data = ${lookup {${local_part}.txt} \
                   dsearch,ret=key,filter=file \
                   {GIVEN_DIRECTORY} \
                  {${sg {$value}{\.txt\$}{}}} \
		 fail \
                  }

with the verified value arriving in $address_data ?


Note that the address_data option is evaluated after the rest of the
router preconditions, so you can't use it's result in the local_part
option.  So that "fail" is needed, to do the work of the local_part
option test.
-- 
Cheers,
   Jeremy

-- 
## 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/