From 01523086ebada8fe1cb748cab26a08dd18986480 Mon Sep 17 00:00:00 2001 From: op Date: Fri, 15 Mar 2024 21:52:20 +0000 Subject: [PATCH] set ORIGINAL_RECIPIENT in the environment of mda scripts mostly for compatibility with postfix since some mdas (like public-inbox) make use of it. diff from Philipp (philipp+openbsd [at] bureaucracy [dot] de) ok gilles@ --- usr.sbin/smtpd/mda_unpriv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/smtpd/mda_unpriv.c b/usr.sbin/smtpd/mda_unpriv.c index 1d59550aead..2c097fc04ab 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.8 2021/06/14 17:58:15 eric Exp $ */ +/* $OpenBSD: mda_unpriv.c,v 1.9 2024/03/15 21:52:20 op Exp $ */ /* * Copyright (c) 2018 Gilles Chehade @@ -28,7 +28,7 @@ mda_unpriv(struct dispatcher *dsp, struct deliver *deliver, const char *pw_name, const char *pw_dir) { int idx; - char *mda_environ[11]; + char *mda_environ[12]; char mda_exec[LINE_MAX]; char mda_wrapper[LINE_MAX]; const char *mda_command; @@ -54,6 +54,7 @@ mda_unpriv(struct dispatcher *dsp, struct deliver *deliver, xasprintf(&mda_environ[idx++], "PATH=%s", _PATH_DEFPATH); xasprintf(&mda_environ[idx++], "DOMAIN=%s", deliver->rcpt.domain); xasprintf(&mda_environ[idx++], "HOME=%s", pw_dir); + xasprintf(&mda_environ[idx++], "ORIGINAL_RECIPIENT=%s@%s", deliver->rcpt.user, deliver->rcpt.domain); 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); -- 2.20.1