Removed some fallback cases since that is now done in libutil.

This commit is contained in:
mjl 2000-01-22 09:48:52 +00:00
parent 1b0dcc825d
commit 8e380b472c
1 changed files with 14 additions and 27 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: login.c,v 1.51 2000/01/13 12:43:20 mjl Exp $ */ /* $NetBSD: login.c,v 1.52 2000/01/22 09:48:52 mjl Exp $ */
/*- /*-
* Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994 * Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994
@ -44,7 +44,7 @@ __COPYRIGHT(
#if 0 #if 0
static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94"; static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94";
#endif #endif
__RCSID("$NetBSD: login.c,v 1.51 2000/01/13 12:43:20 mjl Exp $"); __RCSID("$NetBSD: login.c,v 1.52 2000/01/22 09:48:52 mjl Exp $");
#endif /* not lint */ #endif /* not lint */
/* /*
@ -325,10 +325,9 @@ main(argc, argv)
/* /*
* Establish the class now, before we might goto * Establish the class now, before we might goto
* within the next block. pwd can be NULL since it * within the next block. pwd can be NULL since it
* falls back to the "default" class if it is. * falls back to the "default" class if it is.
*/ */
if (pwd != NULL) lc = login_getclass(pwd ? pwd->pw_class : NULL);
lc = login_getclass(pwd->pw_class);
#endif #endif
/* /*
* if we have a valid account name, and it doesn't have a * if we have a valid account name, and it doesn't have a
@ -452,12 +451,8 @@ main(argc, argv)
/* if user not super-user, check for disabled logins */ /* if user not super-user, check for disabled logins */
#ifdef LOGIN_CAP #ifdef LOGIN_CAP
if (!rootlogin || login_getcapbool(lc, "ignorenologin", 0)) { if (!rootlogin || login_getcapbool(lc, "ignorenologin", 0))
char *fname; checknologin(login_getcapstr(lc, "nologin", NULL, NULL));
fname = login_getcapstr(lc, "nologin", NULL, NULL);
checknologin(fname);
}
#else #else
if (!rootlogin) if (!rootlogin)
checknologin(NULL); checknologin(NULL);
@ -553,16 +548,12 @@ main(argc, argv)
dofork(); dofork();
#endif #endif
#ifdef LOGIN_CAP #ifdef LOGIN_CAP
if(lc) { if (setusercontext(lc, pwd, pwd->pw_uid,
if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETALL & ~LOGIN_SETPATH) != 0) {
LOGIN_SETALL & ~LOGIN_SETPATH) != 0) { syslog(LOG_ERR, "setusercontext failed");
syslog(LOG_ERR, "setusercontext failed"); exit(1);
exit(1);
}
} }
else #else
#endif
{
(void)setgid(pwd->pw_gid); (void)setgid(pwd->pw_gid);
initgroups(username, pwd->pw_gid); initgroups(username, pwd->pw_gid);
@ -575,8 +566,7 @@ main(argc, argv)
(void)setuid(0); (void)setuid(0);
else else
(void)setuid(pwd->pw_uid); (void)setuid(pwd->pw_uid);
} #endif
if (*pwd->pw_shell == '\0') if (*pwd->pw_shell == '\0')
pwd->pw_shell = _PATH_BSHELL; pwd->pw_shell = _PATH_BSHELL;
@ -609,10 +599,7 @@ main(argc, argv)
(void)setenv("USER", pwd->pw_name, 1); (void)setenv("USER", pwd->pw_name, 1);
#ifdef LOGIN_CAP #ifdef LOGIN_CAP
if(lc) setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETPATH);
setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETPATH);
else
(void)setenv("PATH", _PATH_DEFPATH, 0);
#else #else
(void)setenv("PATH", _PATH_DEFPATH, 0); (void)setenv("PATH", _PATH_DEFPATH, 0);
#endif #endif