- stevesk@cvs.openbsd.org 2002/07/15 17:15:31
[uidswap.c] little more debugging; ok markus@
This commit is contained in:
parent
41daec7538
commit
1fa330cf35
|
@ -26,6 +26,9 @@
|
||||||
[sshd.c]
|
[sshd.c]
|
||||||
utmp_len is unsigned; display error consistent with other options.
|
utmp_len is unsigned; display error consistent with other options.
|
||||||
ok markus@
|
ok markus@
|
||||||
|
- stevesk@cvs.openbsd.org 2002/07/15 17:15:31
|
||||||
|
[uidswap.c]
|
||||||
|
little more debugging; ok markus@
|
||||||
|
|
||||||
20020722
|
20020722
|
||||||
- (bal) AIX tty data limiting patch fix by leigh@solinno.co.uk
|
- (bal) AIX tty data limiting patch fix by leigh@solinno.co.uk
|
||||||
|
@ -1449,4 +1452,4 @@
|
||||||
- (stevesk) entropy.c: typo in debug message
|
- (stevesk) entropy.c: typo in debug message
|
||||||
- (djm) ssh-keygen -i needs seeded RNG; report from markus@
|
- (djm) ssh-keygen -i needs seeded RNG; report from markus@
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.2402 2002/07/23 21:15:13 mouring Exp $
|
$Id: ChangeLog,v 1.2403 2002/07/23 21:29:49 mouring Exp $
|
||||||
|
|
15
uidswap.c
15
uidswap.c
|
@ -12,7 +12,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: uidswap.c,v 1.22 2002/05/28 21:24:00 stevesk Exp $");
|
RCSID("$OpenBSD: uidswap.c,v 1.23 2002/07/15 17:15:31 stevesk Exp $");
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "uidswap.h"
|
#include "uidswap.h"
|
||||||
|
@ -52,8 +52,9 @@ temporarily_use_uid(struct passwd *pw)
|
||||||
#ifdef SAVED_IDS_WORK_WITH_SETEUID
|
#ifdef SAVED_IDS_WORK_WITH_SETEUID
|
||||||
saved_euid = geteuid();
|
saved_euid = geteuid();
|
||||||
saved_egid = getegid();
|
saved_egid = getegid();
|
||||||
debug("temporarily_use_uid: %u/%u (e=%u)",
|
debug("temporarily_use_uid: %u/%u (e=%u/%u)",
|
||||||
(u_int)pw->pw_uid, (u_int)pw->pw_gid, (u_int)saved_euid);
|
(u_int)pw->pw_uid, (u_int)pw->pw_gid,
|
||||||
|
(u_int)saved_euid, (u_int)saved_egid);
|
||||||
if (saved_euid != 0) {
|
if (saved_euid != 0) {
|
||||||
privileged = 0;
|
privileged = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -105,13 +106,15 @@ temporarily_use_uid(struct passwd *pw)
|
||||||
void
|
void
|
||||||
restore_uid(void)
|
restore_uid(void)
|
||||||
{
|
{
|
||||||
debug("restore_uid");
|
|
||||||
/* it's a no-op unless privileged */
|
/* it's a no-op unless privileged */
|
||||||
if (!privileged)
|
if (!privileged) {
|
||||||
|
debug("restore_uid: (unprivileged)");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (!temporarily_use_uid_effective)
|
if (!temporarily_use_uid_effective)
|
||||||
fatal("restore_uid: temporarily_use_uid not effective");
|
fatal("restore_uid: temporarily_use_uid not effective");
|
||||||
|
|
||||||
|
debug("restore_uid: %u/%u", (u_int)saved_euid, (u_int)saved_egid);
|
||||||
#ifdef SAVED_IDS_WORK_WITH_SETEUID
|
#ifdef SAVED_IDS_WORK_WITH_SETEUID
|
||||||
/* Set the effective uid back to the saved privileged uid. */
|
/* Set the effective uid back to the saved privileged uid. */
|
||||||
if (seteuid(saved_euid) < 0)
|
if (seteuid(saved_euid) < 0)
|
||||||
|
@ -142,6 +145,8 @@ permanently_set_uid(struct passwd *pw)
|
||||||
{
|
{
|
||||||
if (temporarily_use_uid_effective)
|
if (temporarily_use_uid_effective)
|
||||||
fatal("permanently_set_uid: temporarily_use_uid effective");
|
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 (setgid(pw->pw_gid) < 0)
|
if (setgid(pw->pw_gid) < 0)
|
||||||
fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
|
fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
|
||||||
if (setuid(pw->pw_uid) < 0)
|
if (setuid(pw->pw_uid) < 0)
|
||||||
|
|
Loading…
Reference in New Issue