Hi all,

As discussed on IRC with Gilles, when using virtual table expansions
or a .forward file and the lookup fail, smtpd will respond with:
"524 5.2.4 Mailing list expansion problem", which I find vague and
confusing.

The reason for this was to make smtpd mimic the behaviour of sendmail
and to differentiate between an invalid recipient and a valid recipient
that has a configuration error, such as a broken .forward.

I can see the reasoning behind it, yet I find it very vague and it also
somewhat "leaks" details how your server is configured.

I would prefer an error like "550 Invalid recipient", since it's much
more accurate for the user sending the mail.  Also it gives a much more
unified response when the recipient address is incorrect.


Regards,
Jesper

ps, while writing this mail, satanist on IRC suggested the workaround
of adding 'rcpt-to <virtuals>', which might invalidate my
suggestion/patch... Still, I find the mailing list expansion error more
confusing than helpful.



Index: lka_session.c
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/lka_session.c,v
retrieving revision 1.100
diff -u -p -r1.100 lka_session.c
--- lka_session.c       2 Feb 2024 23:33:42 -0000       1.100
+++ lka_session.c       13 May 2024 21:12:22 -0000
@@ -163,9 +163,9 @@ lka_session_forward_reply(struct forward
        }
 
        if (lks->error == LKA_TEMPFAIL && lks->errormsg == NULL)
-               lks->errormsg = "424 4.2.4 Mailing list expansion problem";
+               lks->errormsg = "450 Invalid recipient";
        if (lks->error == LKA_PERMFAIL && lks->errormsg == NULL)
-               lks->errormsg = "524 5.2.4 Mailing list expansion problem";
+               lks->errormsg = "550 Invalid recipient";
 
        lka_resume(lks);
 }
@@ -194,7 +194,7 @@ lka_resume(struct lka_session *lks)
                log_trace(TRACE_EXPAND, "expand: lka_done: expanded to empty "
                    "delivery list");
                lks->error = LKA_PERMFAIL;
-               lks->errormsg = "524 5.2.4 Mailing list expansion problem";
+               lks->errormsg = "550 Invalid recipient";
        }
     error:
        if (lks->error) {
@@ -255,7 +255,7 @@ lka_expand(struct lka_session *lks, stru
        if (xn->depth >= EXPAND_DEPTH) {
                log_trace(TRACE_EXPAND, "expand: lka_expand: node too deep.");
                lks->error = LKA_PERMFAIL;
-               lks->errormsg = "524 5.2.4 Mailing list expansion problem";
+               lks->errormsg = "550 Invalid recipient";
                return;
        }
 
@@ -331,9 +331,9 @@ lka_expand(struct lka_session *lks, stru
                                    "no aliases for virtual");
                        }
                        if (lks->error == LKA_TEMPFAIL && lks->errormsg == NULL)
-                               lks->errormsg = "424 4.2.4 Mailing list 
expansion problem";
+                               lks->errormsg = "450 Invalid recipient";
                        if (lks->error == LKA_PERMFAIL && lks->errormsg == NULL)
-                               lks->errormsg = "524 5.2.4 Mailing list 
expansion problem";
+                               lks->errormsg = "550 Invalid recipient";
                }
                else {
                        lks->expand.rule = rule;

Reply via email to