From b00e4d7b8f7d3dbd6c74191d3c96c2a7ebcb30a0 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 20 Jul 1996 09:11:00 +0000 Subject: use euid/egid to get into homedir; from dean@fsa.ca --- usr.bin/login/login.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index 6577455c3d2..d9f4075cc4f 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -1,4 +1,4 @@ -/* $OpenBSD: login.c,v 1.4 1996/06/26 05:36:01 deraadt Exp $ */ +/* $OpenBSD: login.c,v 1.5 1996/07/20 09:10:59 deraadt Exp $ */ /* $NetBSD: login.c,v 1.13 1996/05/15 23:50:16 jtc Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94"; #endif -static char rcsid[] = "$OpenBSD: login.c,v 1.4 1996/06/26 05:36:01 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: login.c,v 1.5 1996/07/20 09:10:59 deraadt Exp $"; #endif /* not lint */ /* @@ -338,6 +338,9 @@ main(argc, argv) if (!rootlogin) checknologin(); + setegid(pwd->pw_gid); + seteuid(pwd->pw_uid); + if (chdir(pwd->pw_dir) < 0) { (void)printf("No home directory %s!\n", pwd->pw_dir); if (chdir("/")) @@ -348,6 +351,9 @@ main(argc, argv) quietlog = access(_PATH_HUSHLOGIN, F_OK) == 0; + seteuid(0); + setegid(0); /* XXX use a saved gid instead? */ + if (pwd->pw_change || pwd->pw_expire) (void)gettimeofday(&tp, (struct timezone *)NULL); if (pwd->pw_change) -- cgit v1.2.3