summaryrefslogtreecommitdiff
path: root/uidswap.c
diff options
context:
space:
mode:
Diffstat (limited to 'uidswap.c')
-rw-r--r--uidswap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/uidswap.c b/uidswap.c
index 3786e276f..e29790140 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: uidswap.c,v 1.15 2001/04/08 11:24:33 markus Exp $"); 15RCSID("$OpenBSD: uidswap.c,v 1.16 2001/04/20 16:32:22 markus Exp $");
16 16
17#include "log.h" 17#include "log.h"
18#include "uidswap.h" 18#include "uidswap.h"
@@ -81,7 +81,7 @@ temporarily_use_uid(struct passwd *pw)
81} 81}
82 82
83/* 83/*
84 * Restores to the original uid. 84 * Restores to the original (privileged) uid.
85 */ 85 */
86void 86void
87restore_uid(void) 87restore_uid(void)
@@ -92,7 +92,7 @@ restore_uid(void)
92 return; 92 return;
93 if (!temporarily_use_uid_effective) 93 if (!temporarily_use_uid_effective)
94 fatal("restore_uid: temporarily_use_uid not effective"); 94 fatal("restore_uid: temporarily_use_uid not effective");
95 /* Set the effective uid back to the saved uid. */ 95 /* Set the effective uid back to the saved privileged uid. */
96 if (seteuid(saved_euid) < 0) 96 if (seteuid(saved_euid) < 0)
97 fatal("seteuid %u: %.100s", (u_int) saved_euid, strerror(errno)); 97 fatal("seteuid %u: %.100s", (u_int) saved_euid, strerror(errno));
98 if (setgroups(saved_egroupslen, saved_egroups) < 0) 98 if (setgroups(saved_egroupslen, saved_egroups) < 0)
@@ -111,8 +111,8 @@ permanently_set_uid(struct passwd *pw)
111{ 111{
112 if (temporarily_use_uid_effective) 112 if (temporarily_use_uid_effective)
113 fatal("restore_uid: temporarily_use_uid effective"); 113 fatal("restore_uid: temporarily_use_uid effective");
114 if (setuid(pw->pw_uid) < 0)
115 fatal("setuid %u: %.100s", (u_int) pw->pw_uid, strerror(errno));
116 if (setgid(pw->pw_gid) < 0) 114 if (setgid(pw->pw_gid) < 0)
117 fatal("setgid %u: %.100s", (u_int) pw->pw_gid, strerror(errno)); 115 fatal("setgid %u: %.100s", (u_int) pw->pw_gid, strerror(errno));
116 if (setuid(pw->pw_uid) < 0)
117 fatal("setuid %u: %.100s", (u_int) pw->pw_uid, strerror(errno));
118} 118}