Hi.

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).

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.


Eric.

Index: aliases.c
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/aliases.c,v
retrieving revision 1.77
diff -u -p -r1.77 aliases.c
--- aliases.c   28 Dec 2018 12:47:28 -0000      1.77
+++ aliases.c   26 Apr 2020 16:04:51 -0000
@@ -164,6 +164,10 @@ aliases_virtual_get(struct expand *expan
        if (ret)
                goto expand;
 
+       /* Do not try catch-all entries if there is no domain */
+       if (domain[0] == '\0')
+               return 0;
+
        if (!bsnprintf(buf, sizeof(buf), "@%s", domain))
                return 0;
        /* Failed ? We lookup for catch all for virtual domain */

Reply via email to