> On 5 Jul 2022, at 7:31 am, Wietse Venema <[email protected]> wrote:
> 
>> This lookup table looks for the sender address and returns the SASL 
>> username that is allowed to send mail with that address. I could (with 
>> much additional complexity) generate all the app-specific uids and 
>> return these, but I prefer keeping it simple.
> 
> Could you use a regexp: or pcre: tabble?
> https://www.postfix.org/pcre_table.5.html
> https://pcre.org/current/doc/html/pcre2syntax.html

I don't think this can work, because the request is not to match
variable senders in the lookup key, but rather for a single key
to return an RHS value that is itself a SASL login *pattern*.

That said, if the application sending email could be convinced to
explicitly specify envelope sender address extensions, so that each
SASL login has its own dedicated sender address, compatible with a
table of the form:

 # Sender address           login (same as sender)
 [email protected] [email protected]
 [email protected] [email protected]
 [email protected] [email protected]
 ...

then the whole thing could be (carefully) simulated with an RE table:

        # PCRE only
        /^(magicuser[+][^,\s@]+@example\.com)$/ $1

where "carefully" means not allowing at least ",", whitespace and
perhaps other characters in the extension.  Or just specify a set
of allowed characters:

        # PCRE only
        /^(magicuser[+][-\w]+@example\.com)$/   $1

-- 
        Viktor.

Reply via email to