diff --git a/ChangeLog b/ChangeLog index 48ffaa566..fbe2bbaa0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 20040812 - (dtucker) [sshd.c] Remove duplicate variable imported during sync. + - (dtucker) OpenBSD CVS Sync + - markus@cvs.openbsd.org 2004/07/28 08:56:22 + [sshd.c] + call setsid() _before_ re-exec 20040720 - (djm) OpenBSD CVS Sync @@ -1567,4 +1571,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.3489 2004/08/12 12:16:55 dtucker Exp $ +$Id: ChangeLog,v 1.3490 2004/08/12 12:36:51 dtucker Exp $ diff --git a/sshd.c b/sshd.c index 8b797e07e..cc051432f 100644 --- a/sshd.c +++ b/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 #include @@ -1548,6 +1548,21 @@ 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 !defined(SSHD_ACQUIRES_CTTY) + /* + * If setsid is called, on some platforms sshd will later acquire a + * controlling terminal which will result in "could not set + * controlling tty" errors. + */ + if (!debug_flag && !inetd_flag && setsid() < 0) + error("setsid: %.100s", strerror(errno)); +#endif + if (rexec_flag) { int fd; @@ -1587,21 +1602,6 @@ main(int ac, char **av) sock_in, sock_out, newsock, startup_pipe, config_s[0]); } - /* - * 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 !defined(SSHD_ACQUIRES_CTTY) - /* - * If setsid is called, on some platforms sshd will later acquire a - * controlling terminal which will result in "could not set - * controlling tty" errors. - */ - if (!debug_flag && !inetd_flag && setsid() < 0) - error("setsid: %.100s", strerror(errno)); -#endif - /* * 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