summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2024-02-02 23:33:43 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2024-02-02 23:33:43 +0000
commitb4073bcddabc6985631d4c959bdf21949a987787 (patch)
treee3465358d6027394c93503a352be116b3f19d6a4 /usr.sbin/smtpd
parent22b8f21c1040917097f1462b0a44e8dec480f3d7 (diff)
when an alternate delivery user is provided in a dispatcher, do not process
any recipient .forward file except that of the alternate delivery user. ok millert@
Diffstat (limited to 'usr.sbin/smtpd')
-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;