April 28, 2020 8:55 AM, "Joerg Jung" <m...@umaxx.net> wrote:

>> On 26. Apr 2020, at 18:30, Eric Faurot <e...@faurot.net> wrote:
>> 
>> When a catch-all entry (@) is used in a virtual alias table, it
>> eventually (and mistakenly) catches everything that expands to a
>> username. For example, with:
>> 
>> f...@example.com user
>> @ catchall
>> 
>> "f...@example.com" expands to "user" as expected, but then "user"
>> expands to "catchall" because it is interpreted as "user@" (empty
>> domain).
> 
> Which makes sense to me. If one doesn’t specify a domain after the ‘@‘,
> I would expect to really catch-all for all domains and all users.
> 

that's not how mailaddr work in OpenSMTPD, the semantic is this one:

user        => user@*
user@domain => user@domain
@domain     => *@domain
@           => *

and this is not an aliases only thing, this is how table lookups are
performed for type K_MAILADDR.

This allows you to do stuff like follows:

root             : root
gil...@poolp.org : gilles
e...@faurot.net  : eric
@poolp.org       : poolpcatchall
@faurot.net      : faurotcatchall
@                : catchallusuer


>> The catch-all fallback mechanism is really meant for full email
>> addresses in virtual context, and should not happen for usernames.
>> The following diff fixes it.
> 
> Yes, I agree that catch-all only really meant to be used for single virtual
> domain context and not with primary domains.
> 
> But instead of allowing the syntax and ignoring the case in aliases.c
> as in your diff below, I would prefer to “fail" on parsing of the table and
> error logging that an empty domain after ‘@‘ is not a valid syntax, no?
> 
> Also this change might break existing valid setups (e.g. with mailing list
> servers), but people will likely know how to cope with it.
> 

Do you have an example of an existing valid setup that is broken with this ?

Reply via email to