summaryrefslogtreecommitdiffstats
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorchrisz <chrisz@openbsd.org>2020-06-01 05:21:30 +0000
committerchrisz <chrisz@openbsd.org>2020-06-01 05:21:30 +0000
commitd8fe1c91482f96f63d0bb07e35417908c4fee488 (patch)
tree9070eff419fbb4ada501bc89b48b9017fdb1d803 /usr.sbin/smtpd
parentsync (diff)
downloadwireguard-openbsd-d8fe1c91482f96f63d0bb07e35417908c4fee488.tar.xz
wireguard-openbsd-d8fe1c91482f96f63d0bb07e35417908c4fee488.zip
Run lmtp deliveries as SMTPD_USER instead of the recipient user.
ok millert@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/mda_unpriv.c6
-rw-r--r--usr.sbin/smtpd/parse.y4
2 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/mda_unpriv.c b/usr.sbin/smtpd/mda_unpriv.c
index 636bb59aef1..23093ae899c 100644
--- a/usr.sbin/smtpd/mda_unpriv.c
+++ b/usr.sbin/smtpd/mda_unpriv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mda_unpriv.c,v 1.6 2020/02/02 22:13:48 gilles Exp $ */
+/* $OpenBSD: mda_unpriv.c,v 1.7 2020/06/01 05:21:30 chrisz Exp $ */
/*
* Copyright (c) 2018 Gilles Chehade <gilles@poolp.org>
@@ -69,8 +69,8 @@ mda_unpriv(struct dispatcher *dsp, struct deliver *deliver,
xasprintf(&mda_environ[idx++], "RECIPIENT=%s@%s", deliver->dest.user, deliver->dest.domain);
xasprintf(&mda_environ[idx++], "SHELL=/bin/sh");
xasprintf(&mda_environ[idx++], "LOCAL=%s", deliver->rcpt.user);
- xasprintf(&mda_environ[idx++], "LOGNAME=%s", pw_name);
- xasprintf(&mda_environ[idx++], "USER=%s", pw_name);
+ xasprintf(&mda_environ[idx++], "LOGNAME=%s", deliver->userinfo.username);
+ xasprintf(&mda_environ[idx++], "USER=%s", deliver->userinfo.username);
if (deliver->sender.user[0])
xasprintf(&mda_environ[idx++], "SENDER=%s@%s",
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index 4d187f7a42e..4d1c46a62e3 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.277 2020/02/24 23:54:27 millert Exp $ */
+/* $OpenBSD: parse.y,v 1.278 2020/06/01 05:21:30 chrisz Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -690,10 +690,12 @@ MBOX {
| LMTP STRING {
asprintf(&dispatcher->u.local.command,
"/usr/libexec/mail.lmtp -d %s -u", $2);
+ dispatcher->u.local.user = SMTPD_USER;
} dispatcher_local_options
| LMTP STRING RCPT_TO {
asprintf(&dispatcher->u.local.command,
"/usr/libexec/mail.lmtp -d %s -r", $2);
+ dispatcher->u.local.user = SMTPD_USER;
} dispatcher_local_options
| MDA STRING {
asprintf(&dispatcher->u.local.command,