=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/sshd.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- src/usr.bin/ssh/sshd.c 1999/10/11 21:48:29 1.28 +++ src/usr.bin/ssh/sshd.c 1999/10/12 05:45:43 1.29 @@ -18,7 +18,7 @@ */ #include "includes.h" -RCSID("$Id: sshd.c,v 1.28 1999/10/11 21:48:29 markus Exp $"); +RCSID("$Id: sshd.c,v 1.29 1999/10/12 05:45:43 deraadt Exp $"); #include "xmalloc.h" #include "rsa.h" @@ -1697,6 +1697,11 @@ log_init(av0, debug_flag && !inetd_flag, debug_flag, options.quiet_mode, options.log_facility); + /* Create a new session and process group since the 4.4BSD setlogin() + affects the entire process group. */ + if (setsid() < 0) + error("setsid failed: %.100s", strerror(errno)); + #ifdef USE_PIPES /* Redirect stdin. We close the parent side of the socket pair, and make the child side the standard input. */ @@ -2068,7 +2073,8 @@ } /* Set login name in the kernel. */ - setlogin(pw->pw_name); + if (setlogin(pw->pw_name) < 0) + error("setlogin failed: %s", strerror(errno)); /* Set uid, gid, and groups. */ /* Login(1) does this as well, and it needs uid 0 for the "-h" switch,