summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/uidswap.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-05-29 16:58:46 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-05-29 16:58:46 +0000
commit574eb06e52df64db068d870c4035ec890dc3a1bd (patch)
tree629f7bdd914232995f04a7cb39b362fae302d62c /usr.bin/ssh/uidswap.c
parent4f46bcfdf7afda31f83bcebae5b199a9b048b883 (diff)
seteuid and setegid; markus ok
Diffstat (limited to 'usr.bin/ssh/uidswap.c')
-rw-r--r--usr.bin/ssh/uidswap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/ssh/uidswap.c b/usr.bin/ssh/uidswap.c
index 791f368256d..de7dc9db7d1 100644
--- a/usr.bin/ssh/uidswap.c
+++ b/usr.bin/ssh/uidswap.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: uidswap.c,v 1.23 2002/07/15 17:15:31 stevesk Exp $");
+RCSID("$OpenBSD: uidswap.c,v 1.24 2003/05/29 16:58:45 deraadt Exp $");
#include "log.h"
#include "uidswap.h"
@@ -115,8 +115,12 @@ 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));
}