- (dtucker) [uidswap.c] Don't test dropping of gids for the root user or

on Cygwin.  Cygwin parts from vinschen at redhat com; ok djm@
This commit is contained in:
Darren Tucker 2004-10-19 16:33:33 +10:00
parent 0e035d816a
commit 35beaddc7e
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,7 @@
20041019
- (dtucker) [uidswap.c] Don't test dropping of gids for the root user or
on Cygwin. Cygwin parts from vinschen at redhat com; ok djm@
20041016
- (djm) [auth-pam.c] snprintf->strl*, fix server message length calculations;
ok dtucker@
@ -1767,4 +1771,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.3560 2004/10/16 08:53:28 djm Exp $
$Id: ChangeLog,v 1.3561 2004/10/19 06:33:33 dtucker Exp $

View File

@ -200,10 +200,12 @@ permanently_set_uid(struct passwd *pw)
fatal("setuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
#endif
#ifndef HAVE_CYGWIN
/* Try restoration of GID if changed (test clearing of saved gid) */
if (old_gid != pw->pw_gid &&
if (old_gid != pw->pw_gid && pw->pw_uid != 0 &&
(setgid(old_gid) != -1 || setegid(old_gid) != -1))
fatal("%s: was able to restore old [e]gid", __func__);
#endif
/* Verify GID drop was successful */
if (getgid() != pw->pw_gid || getegid() != pw->pw_gid) {