summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/mda.c
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2018-12-27 15:41:51 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2018-12-27 15:41:51 +0000
commit0b980b1d7414c3c56906af376f3961531ce4c175 (patch)
treed18006efe19412f96ebf5e972ee2c27679e8b41a /usr.sbin/smtpd/mda.c
parent5ad1bbdbdc081ee2d9d820e8f4edafc1d05dbacc (diff)
extract subaddress from last resolved node, not from dest or rcpt address
which was incorrect and can lead to ambiguous cases, this will affect the people who were using subaddresses within aliases themselves AND expected deliveries to a maildir subdir of the recipient user. ok eric@
Diffstat (limited to 'usr.sbin/smtpd/mda.c')
-rw-r--r--usr.sbin/smtpd/mda.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c
index ed7911a2d01..06b88907d57 100644
--- a/usr.sbin/smtpd/mda.c
+++ b/usr.sbin/smtpd/mda.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mda.c,v 1.135 2018/10/30 14:17:17 gilles Exp $ */
+/* $OpenBSD: mda.c,v 1.136 2018/12/27 15:41:50 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -55,6 +55,7 @@ struct mda_envelope {
char *dest;
char *user;
char *dispatcher;
+ char *mda_subaddress;
char *mda_exec;
};
@@ -274,6 +275,8 @@ mda_imsg(struct mproc *p, struct imsg *imsg)
text_to_mailaddr(&deliver.dest, s->evp->dest);
if (s->evp->mda_exec)
(void)strlcpy(deliver.mda_exec, s->evp->mda_exec, sizeof deliver.mda_exec);
+ if (s->evp->mda_subaddress)
+ (void)strlcpy(deliver.mda_subaddress, s->evp->mda_subaddress, sizeof deliver.mda_subaddress);
(void)strlcpy(deliver.dispatcher, s->evp->dispatcher, sizeof deliver.dispatcher);
deliver.userinfo = s->user->userinfo;
@@ -812,6 +815,8 @@ mda_envelope(const struct envelope *evp)
e->dispatcher = xstrdup(evp->dispatcher);
if (evp->mda_exec[0])
e->mda_exec = xstrdup(evp->mda_exec);
+ if (evp->mda_subaddress[0])
+ e->mda_subaddress = xstrdup(evp->mda_subaddress);
stat_increment("mda.envelope", 1);
return (e);
}