diff options
author | ache <ache@FreeBSD.org> | 1999-04-24 17:26:32 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1999-04-24 17:26:32 +0000 |
commit | cef495690ee04d65298ff3d61aacc11b88dd5c12 (patch) | |
tree | 73223e4409811543f988f1150d5eb2da7825b62d /usr.bin | |
parent | aa57b67a291a075886a47e2b47b799834b376aef (diff) | |
download | FreeBSD-src-cef495690ee04d65298ff3d61aacc11b88dd5c12.zip FreeBSD-src-cef495690ee04d65298ff3d61aacc11b88dd5c12.tar.gz |
remove uid switching before login_getpwclass, now done inside libutil
add gid switching before chdir and comment why it needed
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/login/login.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index 34698e0..2024a43 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.45 1999/01/19 22:59:37 abial Exp $"; + "$Id: login.c,v 1.46 1999/04/07 14:05:03 brian Exp $"; #endif /* not lint */ /* @@ -138,6 +138,7 @@ main(argc, argv) int changepass; time_t warntime; uid_t uid, euid; + gid_t egid; char *p, *ttyn; char tbuf[MAXPATHLEN + 2]; char tname[sizeof(_PATH_TTY) + 10]; @@ -171,6 +172,7 @@ main(argc, argv) fflag = hflag = pflag = 0; uid = getuid(); euid = geteuid(); + egid = getegid(); while ((ch = getopt(argc, argv, "fh:p")) != -1) switch (ch) { case 'f': @@ -347,15 +349,15 @@ main(argc, argv) /* * Establish the login class. */ - (void)seteuid(rootlogin ? 0 : pwd->pw_uid); lc = login_getpwclass(pwd); - seteuid(euid); /* if user not super-user, check for disabled logins */ if (!rootlogin) auth_checknologin(lc); quietlog = login_getcapbool(lc, "hushlogin", 0); + /* Switching needed for NFS with root access disabled */ + (void)setegid(pwd->pw_gid); (void)seteuid(rootlogin ? 0 : pwd->pw_uid); if (!*pwd->pw_dir || chdir(pwd->pw_dir) < 0) { if (login_getcapbool(lc, "requirehome", 0)) @@ -367,6 +369,7 @@ main(argc, argv) printf("No home directory.\nLogging in with home = \"/\".\n"); } (void)seteuid(euid); + (void)setegid(egid); if (!quietlog) quietlog = access(_PATH_HUSHLOGIN, F_OK) == 0; |