summaryrefslogtreecommitdiffstats
path: root/usr.sbin/httpd
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r--usr.sbin/httpd/httpd.h3
-rw-r--r--usr.sbin/httpd/proc.c12
2 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h
index 3b3d157932d..68836c83083 100644
--- a/usr.sbin/httpd/httpd.h
+++ b/usr.sbin/httpd/httpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: httpd.h,v 1.120 2016/09/28 12:01:04 reyk Exp $ */
+/* $OpenBSD: httpd.h,v 1.121 2016/10/05 16:58:19 reyk Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -270,6 +270,7 @@ struct privsep_proc {
const char *p_chroot;
struct privsep *p_ps;
void (*p_shutdown)(void);
+ struct passwd *p_pw;
};
struct privsep_fd {
diff --git a/usr.sbin/httpd/proc.c b/usr.sbin/httpd/proc.c
index 5ea7e5f4eb9..d7f1e015095 100644
--- a/usr.sbin/httpd/proc.c
+++ b/usr.sbin/httpd/proc.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: proc.c,v 1.27 2016/09/28 12:01:04 reyk Exp $ */
+/* $OpenBSD: proc.c,v 1.28 2016/10/05 16:58:19 reyk Exp $ */
/*
- * Copyright (c) 2010 - 2014 Reyk Floeter <reyk@openbsd.org>
+ * Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -498,7 +498,7 @@ proc_run(struct privsep *ps, struct privsep_proc *p,
struct privsep_proc *procs, unsigned int nproc,
void (*run)(struct privsep *, struct privsep_proc *, void *), void *arg)
{
- struct passwd *pw = ps->ps_pw;
+ struct passwd *pw;
const char *root;
struct control_sock *rcs;
@@ -518,6 +518,12 @@ proc_run(struct privsep *ps, struct privsep_proc *p,
fatalx(__func__);
}
+ /* Use non-standard user */
+ if (p->p_pw != NULL)
+ pw = p->p_pw;
+ else
+ pw = ps->ps_pw;
+
/* Change root directory */
if (p->p_chroot != NULL)
root = p->p_chroot;