From a95ad3cfedee581b2a15135113fbf81ea5c3867d Mon Sep 17 00:00:00 2001 From: gilles Date: Fri, 2 Feb 2024 23:33:42 +0000 Subject: [PATCH] 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@ --- usr.sbin/smtpd/lka_session.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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 @@ -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; -- 2.20.1