[PATCH] permanently_set_uid: Don't try restoring gid on Cygwin

Corinna Vinschen vinschen at redhat.com
Thu Sep 23 04:36:16 EST 2004


Hi,

the below patch solves the same problem for gids as has already been
solved for uids. Windows has no concept of permanently changing the
identity.  It's always possible to revert to the original identity.

Thanks,
Corinna


Index: uidswap.c
===================================================================
RCS file: /cvs/openssh_cvs/uidswap.c,v
retrieving revision 1.44
diff -p -u -r1.44 uidswap.c
--- uidswap.c	24 Feb 2004 02:17:30 -0000	1.44
+++ uidswap.c	22 Sep 2004 18:17:44 -0000
@@ -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 &&
 	    (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) {


-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat, Inc.




More information about the openssh-unix-dev mailing list