summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-04-30 16:48:20 +0000
committerpeter <peter@FreeBSD.org>1998-04-30 16:48:20 +0000
commit0534b5c829f8d2b45b80f266517b4322ad3ead03 (patch)
tree8365e1267dded8da13cead7973b0b2760b133303 /usr.bin
parent6a800a155d9582fc949072c76cce1dd5048166d5 (diff)
downloadFreeBSD-src-0534b5c829f8d2b45b80f266517b4322ad3ead03.zip
FreeBSD-src-0534b5c829f8d2b45b80f266517b4322ad3ead03.tar.gz
Change euid while reading the user's .login_cap file in case the homedir
is on a NFS partion without root read access. Also, flip euid again for the duration of the chdir() to the homedir for the same reason. PR: 5145 Submitted by: Joel.Faedi@esial.u-nancy.fr Also tested by: A Joseph Koshy <koshy@india.hp.com>
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 ae3618a..d94513a 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -42,7 +42,7 @@ static char copyright[] =
static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94";
#endif
static const char rcsid[] =
- "$Id: login.c,v 1.31 1998/02/05 18:37:02 guido Exp $";
+ "$Id: login.c,v 1.32 1998/02/13 21:02:53 ache Exp $";
#endif /* not lint */
/*
@@ -157,7 +157,7 @@ main(argc, argv)
int ask, ch, cnt, fflag, hflag, pflag, quietlog, rootlogin, rval;
int changepass;
time_t warntime;
- uid_t uid;
+ uid_t uid, eiud;
char *domain, *p, *ep, *salt, *ttyn;
char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_TTY) + 10];
char localhost[MAXHOSTNAMELEN];
@@ -199,6 +199,7 @@ main(argc, argv)
fflag = hflag = pflag = 0;
uid = getuid();
+ euid = geteuid();
while ((ch = getopt(argc, argv, "fh:p")) != -1)
switch (ch) {
case 'f':
@@ -336,7 +337,10 @@ main(argc, argv)
* within the next block. pwd can be NULL since it
* falls back to the "default" class if it is.
*/
+ if (pwd != NULL)
+ (void)seteuid(rootlogin ? 0 : pwd->pw_uid);
lc = login_getpwclass(pwd);
+ seteuid(euid);
#endif /* LOGIN_CAP */
/*
@@ -541,6 +545,7 @@ main(argc, argv)
#else
quietlog = 0;
#endif
+ (void)seteuid(rootlogin ? 0 : pwd->pw_uid);
if (!*pwd->pw_dir || chdir(pwd->pw_dir) < 0) {
#ifdef LOGIN_CAP
if (login_getcapbool(lc, "requirehome", 0))
@@ -552,6 +557,7 @@ main(argc, argv)
if (!quietlog || *pwd->pw_dir)
printf("No home directory.\nLogging in with home = \"/\".\n");
}
+ (void)seteuid(euid);
if (!quietlog)
quietlog = access(_PATH_HUSHLOGIN, F_OK) == 0;
OpenPOWER on IntegriCloud