summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-20 09:11:00 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-20 09:11:00 +0000
commitb00e4d7b8f7d3dbd6c74191d3c96c2a7ebcb30a0 (patch)
treefe99d9d9649099b88bf938dbab2829d547b918c1 /usr.bin
parent4a4f540d0d6f8623e1824a0786d2e42008049b20 (diff)
use euid/egid to get into homedir; from dean@fsa.ca
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/login/login.c10
1 files changed, 8 insertions, 2 deletions
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)