summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/proc.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2016-10-05 17:10:01 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2016-10-05 17:10:01 +0000
commita25e9f569be24ac323b1af3c8602d6d582207ca9 (patch)
treead6fcc93f617664a0c4cb2714fffd45c38b0c2d9 /usr.sbin/relayd/proc.c
parent44a5924975207ec2ac9e1a234e2230657338194f (diff)
Call setsid() to create a new session for the executed processes.
From deraadt@ OK rzalamena@
Diffstat (limited to 'usr.sbin/relayd/proc.c')
-rw-r--r--usr.sbin/relayd/proc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/relayd/proc.c b/usr.sbin/relayd/proc.c
index 6c5a764126c..78a602f12b2 100644
--- a/usr.sbin/relayd/proc.c
+++ b/usr.sbin/relayd/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.34 2016/10/05 16:58:19 reyk Exp $ */
+/* $OpenBSD: proc.c,v 1.35 2016/10/05 17:09:59 reyk Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -130,6 +130,10 @@ proc_exec(struct privsep *ps, struct privsep_proc *procs, unsigned int nproc,
fatal("%s: fork", __func__);
break;
case 0:
+ /* First create a new session */
+ if (setsid() == -1)
+ fatal("setsid");
+
/* Prepare parent socket. */
dup2(fd, PROC_PARENT_SOCK_FILENO);