[PATCH] permanently_set_uid fails on Cygwin :-(

Corinna Vinschen vinschen at redhat.com
Wed Sep 17 00:53:09 EST 2003


I'm terribly sorry that I missed this before 3.7p1 was out.  The
permanently_set_uid() function fails on Cygwin since the test to
revert to the saved uid unfortunately works on Cygwin though it
shouldn't.  The reason is that a Windows NT process always can
revert to its previous privileges.  There's no such concept of
giving up rights in a process permanently. This is only possible
for a child process.


Index: uidswap.c
RCS file: /cvs/openssh_cvs/uidswap.c,v
retrieving revision 1.39
diff -p -u -r1.39 uidswap.c
--- uidswap.c	6 Sep 2003 06:44:39 -0000	1.39
+++ uidswap.c	16 Sep 2003 14:47:54 -0000
@@ -191,10 +191,12 @@ permanently_set_uid(struct passwd *pw)
 	/* Try restoration of UID if changed (test clearing of saved uid) */
 	if (old_uid != pw->pw_uid && 
 	    (setuid(old_uid) != -1 || seteuid(old_uid) != -1))
 		fatal("%s: was able to restore old [e]uid", __func__);
 	/* Verify UID drop was successful */
 	if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) {

Corinna Vinschen
Cygwin Developer
Red Hat, Inc.

More information about the openssh-unix-dev mailing list