diff options
author | 2004-07-28 08:56:22 +0000 | |
---|---|---|
committer | 2004-07-28 08:56:22 +0000 | |
commit | 69a8079729727a1125dc0ff2645830285018d76a (patch) | |
tree | 5f32737f28ee94fe815a5ae00527497d2eb12075 | |
parent | Use less stack space for temporary storage and C code invocation, after (diff) | |
download | wireguard-openbsd-69a8079729727a1125dc0ff2645830285018d76a.tar.xz wireguard-openbsd-69a8079729727a1125dc0ff2645830285018d76a.zip |
call setsid() _before_ re-exec
-rw-r--r-- | usr.bin/ssh/sshd.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index 64ffd771942..0ed454b320e 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/sshd.c @@ -42,7 +42,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshd.c,v 1.299 2004/07/17 05:31:41 dtucker Exp $"); +RCSID("$OpenBSD: sshd.c,v 1.300 2004/07/28 08:56:22 markus Exp $"); #include <openssl/dh.h> #include <openssl/bn.h> @@ -1486,6 +1486,14 @@ main(int ac, char **av) /* This is the child processing a new connection. */ setproctitle("%s", "[accepted]"); + /* + * Create a new session and process group since the 4.4BSD + * setlogin() affects the entire process group. We don't + * want the child to be able to affect the parent. + */ + if (!debug_flag && !inetd_flag && setsid() < 0) + error("setsid: %.100s", strerror(errno)); + if (rexec_flag) { int fd; @@ -1526,14 +1534,6 @@ main(int ac, char **av) } /* - * Create a new session and process group since the 4.4BSD - * setlogin() affects the entire process group. We don't - * want the child to be able to affect the parent. - */ - if (!debug_flag && !inetd_flag && setsid() < 0) - error("setsid: %.100s", strerror(errno)); - - /* * Disable the key regeneration alarm. We will not regenerate the * key since we are no longer in a position to give it to anyone. We * will not restart on SIGHUP since it no longer makes sense. |