diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-12-22 03:26:11 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-12-22 03:26:11 +0000 |
commit | b9e51bce4b9f1693731b39bfbb2873af2e60d83c (patch) | |
tree | 9844363957c023a88374765f72c1a49440395ac5 /usr.bin/su/su.c | |
parent | a34740287ce7a6f408b47749029e29e62a63724d (diff) |
Deal with _POSIX_SAVED_IDS when relinquishing privileges
Diffstat (limited to 'usr.bin/su/su.c')
-rw-r--r-- | usr.bin/su/su.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c index 563a1642f66..11396e3d8bc 100644 --- a/usr.bin/su/su.c +++ b/usr.bin/su/su.c @@ -1,4 +1,4 @@ -/* $OpenBSD: su.c,v 1.16 1996/10/27 16:49:17 millert Exp $ */ +/* $OpenBSD: su.c,v 1.17 1996/12/22 03:26:03 tholo Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. @@ -41,7 +41,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)su.c 5.26 (Berkeley) 7/6/91";*/ -static char rcsid[] = "$OpenBSD: su.c,v 1.16 1996/10/27 16:49:17 millert Exp $"; +static char rcsid[] = "$OpenBSD: su.c,v 1.17 1996/12/22 03:26:03 tholo Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -220,10 +220,14 @@ badlogin: iscsh = strcmp(avshell, "csh") ? NO : YES; /* set permissions */ + if (setegid(pwd->pw_gid) < 0) + err(1, "setegid"); if (setgid(pwd->pw_gid) < 0) err(1, "setgid"); if (initgroups(user, pwd->pw_gid)) err(1, "initgroups failed"); + if (seteuid(pwd->pw_uid) < 0) + err(1, "seteuid"); if (setuid(pwd->pw_uid) < 0) err(1, "setuid"); |