summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/uidswap.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/ssh/uidswap.c')
-rw-r--r--usr.bin/ssh/uidswap.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/usr.bin/ssh/uidswap.c b/usr.bin/ssh/uidswap.c
index f1d3e4764ee..5891b71d4bd 100644
--- a/usr.bin/ssh/uidswap.c
+++ b/usr.bin/ssh/uidswap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uidswap.c,v 1.26 2006/03/25 13:17:03 djm Exp $ */
+/* $OpenBSD: uidswap.c,v 1.27 2006/04/22 04:06:51 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -115,12 +115,8 @@ permanently_set_uid(struct passwd *pw)
fatal("permanently_set_uid: temporarily_use_uid effective");
debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid,
(u_int)pw->pw_gid);
- if (setegid(pw->pw_gid) < 0)
- fatal("setegid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
- if (setgid(pw->pw_gid) < 0)
- fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
- if (seteuid(pw->pw_uid) < 0)
- fatal("seteuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
- if (setuid(pw->pw_uid) < 0)
- fatal("setuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
+ if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) != 0)
+ fatal("setresgid %u: %s", (u_int)pw->pw_gid, strerror(errno));
+ if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) != 0)
+ fatal("setresuid %u: %s", (u_int)pw->pw_uid, strerror(errno));
}