summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/httpd/httpd.h3
-rw-r--r--usr.sbin/httpd/proc.c12
-rw-r--r--usr.sbin/relayd/proc.c12
-rw-r--r--usr.sbin/relayd/relayd.h3
-rw-r--r--usr.sbin/switchd/proc.c12
-rw-r--r--usr.sbin/switchd/proc.h4
6 files changed, 33 insertions, 13 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;
diff --git a/usr.sbin/relayd/proc.c b/usr.sbin/relayd/proc.c
index 56b17277a81..6c5a764126c 100644
--- a/usr.sbin/relayd/proc.c
+++ b/usr.sbin/relayd/proc.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: proc.c,v 1.33 2016/09/28 12:16:44 reyk Exp $ */
+/* $OpenBSD: proc.c,v 1.34 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;
diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h
index 71730938b21..07768775004 100644
--- a/usr.sbin/relayd/relayd.h
+++ b/usr.sbin/relayd/relayd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.h,v 1.234 2016/09/28 12:16:44 reyk Exp $ */
+/* $OpenBSD: relayd.h,v 1.235 2016/10/05 16:58:19 reyk Exp $ */
/*
* Copyright (c) 2006 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -1031,6 +1031,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/switchd/proc.c b/usr.sbin/switchd/proc.c
index b99aadc7cc5..c5a786ac48f 100644
--- a/usr.sbin/switchd/proc.c
+++ b/usr.sbin/switchd/proc.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: proc.c,v 1.4 2016/09/19 09:14:38 rzalamena Exp $ */
+/* $OpenBSD: proc.c,v 1.5 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;
diff --git a/usr.sbin/switchd/proc.h b/usr.sbin/switchd/proc.h
index a2336753a17..c84c210c180 100644
--- a/usr.sbin/switchd/proc.h
+++ b/usr.sbin/switchd/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.3 2016/09/18 13:17:40 rzalamena Exp $ */
+/* $OpenBSD: proc.h,v 1.4 2016/10/05 16:58:19 reyk Exp $ */
/*
* Copyright (c) 2010-2015 Reyk Floeter <reyk@openbsd.org>
@@ -76,7 +76,7 @@ struct privsep_proc {
const char *p_chroot;
struct privsep *p_ps;
void (*p_shutdown)(void);
- unsigned int p_instance;
+ struct passwd *p_pw;
};
struct privsep_fd {