summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpd.c
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-03-10 19:13:29 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-03-10 19:13:29 +0000
commit5f6aa7d613017c9571204cb962e27744598ef521 (patch)
treef73486886a3127cd05534b847b6a3912502db7ef /usr.sbin/smtpd/smtpd.c
parentd22a9a817c515acc064d7766ce700069ff3db84d (diff)
run external mda with cwd set to $HOME or /; ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/smtpd.c')
-rw-r--r--usr.sbin/smtpd/smtpd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index f687dbc0364..31f173f0f33 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.c,v 1.47 2009/03/10 19:09:29 jacekm Exp $ */
+/* $OpenBSD: smtpd.c,v 1.48 2009/03/10 19:13:28 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -1141,6 +1141,9 @@ parent_external_mda(char *path, struct passwd *pw, struct batch *batchp)
if (dup2(pipefd[0], STDIN_FILENO) == -1)
fatal("dup2");
+ if (chdir(pw->pw_dir) == -1 && chdir("/") == -1)
+ fatal("chdir");
+
if (closefrom(STDERR_FILENO + 1) == -1)
fatal("closefrom");