summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/lka_session.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c
index a62f6c6bb0e..cf11dfe3fa8 100644
--- a/usr.sbin/smtpd/lka_session.c
+++ b/usr.sbin/smtpd/lka_session.c
@@ -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;