summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2001-04-20 16:32:22 +0000
committermarkus <markus@openbsd.org>2001-04-20 16:32:22 +0000
commitc023e6c57fa64e482f1ff2c7246e2719c18d314a (patch)
tree209a7afcdf9640369a866a6ff41a502c35b76679
parent10/100 not supported in the MAC on the current models (diff)
downloadwireguard-openbsd-c023e6c57fa64e482f1ff2c7246e2719c18d314a.tar.xz
wireguard-openbsd-c023e6c57fa64e482f1ff2c7246e2719c18d314a.zip
set non-privileged gid before uid; tholo@ and deraadt@
-rw-r--r--usr.bin/ssh/uidswap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/ssh/uidswap.c b/usr.bin/ssh/uidswap.c
index 8380071ce42..39952e2b0fc 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.15 2001/04/08 11:24:33 markus Exp $");
+RCSID("$OpenBSD: uidswap.c,v 1.16 2001/04/20 16:32:22 markus Exp $");
#include "log.h"
#include "uidswap.h"
@@ -81,7 +81,7 @@ temporarily_use_uid(struct passwd *pw)
}
/*
- * Restores to the original uid.
+ * Restores to the original (privileged) uid.
*/
void
restore_uid(void)
@@ -92,7 +92,7 @@ restore_uid(void)
return;
if (!temporarily_use_uid_effective)
fatal("restore_uid: temporarily_use_uid not effective");
- /* Set the effective uid back to the saved uid. */
+ /* Set the effective uid back to the saved privileged uid. */
if (seteuid(saved_euid) < 0)
fatal("seteuid %u: %.100s", (u_int) saved_euid, strerror(errno));
if (setgroups(saved_egroupslen, saved_egroups) < 0)
@@ -111,8 +111,8 @@ permanently_set_uid(struct passwd *pw)
{
if (temporarily_use_uid_effective)
fatal("restore_uid: temporarily_use_uid effective");
- if (setuid(pw->pw_uid) < 0)
- fatal("setuid %u: %.100s", (u_int) pw->pw_uid, strerror(errno));
if (setgid(pw->pw_gid) < 0)
fatal("setgid %u: %.100s", (u_int) pw->pw_gid, strerror(errno));
+ if (setuid(pw->pw_uid) < 0)
+ fatal("setuid %u: %.100s", (u_int) pw->pw_uid, strerror(errno));
}