when an alternate delivery user is provided in a dispatcher, do not process
authorgilles <gilles@openbsd.org>
Fri, 2 Feb 2024 23:33:42 +0000 (23:33 +0000)
committergilles <gilles@openbsd.org>
Fri, 2 Feb 2024 23:33:42 +0000 (23:33 +0000)
any recipient .forward file except that of the alternate delivery user.

ok millert@

usr.sbin/smtpd/lka_session.c

index a62f6c6..cf11dfe 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: lka_session.c,v 1.99 2024/02/02 22:02:12 gilles Exp $ */
+/*     $OpenBSD: lka_session.c,v 1.100 2024/02/02 23:33:42 gilles Exp $        */
 
 /*
  * Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
@@ -406,6 +406,20 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn)
                        break;
                }
 
+
+               /* when alternate delivery user is provided,
+                * skip other users forward files.
+                */
+               if (dsp->u.local.user) {
+                       if (strcmp(dsp->u.local.user, xn->u.user) != 0) {
+                               log_trace(TRACE_EXPAND, "expand: lka_expand: "
+                                   "alternate delivery user mismatch recipient "
+                                   "user, skip .forward, submitting");
+                               lka_submit(lks, rule, xn);
+                               break;
+                       }
+               }
+
                /* no aliases found, query forward file */
                lks->rule = rule;
                lks->node = xn;