Lines Matching refs:pwd
62 #include <pwd.h>
251 if (failures > (pwd ? 0 : 1))
293 pwd = NULL;
294 (void)getpwnam_r(username, &pwres, pwbuf, sizeof(pwbuf), &pwd);
298 * within the next block. pwd can be NULL since it
301 lc = login_getclass(pwd ? pwd->pw_class : NULL);
309 if (pwd) {
310 if (pwd->pw_uid == 0)
313 if (fflag && (uid == 0 || uid == pwd->pw_uid)) {
326 * username, pwd, and lc.
337 pwd = NULL;
339 &pwd);
340 lc = login_getpwclass(pwd);
385 if (pwd && auth_passed)
422 (void)setegid(pwd->pw_gid);
423 if (initgroups(username, pwd->pw_gid) == -1) {
428 (void)seteuid(pwd->pw_uid);
430 if (chdir(pwd->pw_dir) != 0) {
433 pwd->pw_dir);
438 (void)printf("No home directory %s!\n", pwd->pw_dir);
443 pwd->pw_dir = __UNCONST("/");
462 (void)chown(ttyn, pwd->pw_uid,
463 (grp != NULL) ? grp->gr_gid : pwd->pw_gid);
465 if (ttyaction(ttyn, "login", pwd->pw_name))
471 if (nested == NULL && setusercontext(lc, pwd, pwd->pw_uid,
481 if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETGROUP) != 0) {
571 if (*pwd->pw_shell == '\0')
572 pwd->pw_shell = __UNCONST(_PATH_BSHELL);
574 shell = login_getcapstr(lc, "shell", pwd->pw_shell, pwd->pw_shell);
576 shell = pwd->pw_shell;
578 if ((pwd->pw_shell = strdup(shell)) == NULL) {
583 (void)setenv("HOME", pwd->pw_dir, 1);
584 (void)setenv("SHELL", pwd->pw_shell, 1);
595 (void)setenv("LOGNAME", pwd->pw_name, 1);
596 (void)setenv("USER", pwd->pw_name, 1);
613 if (setusercontext(lc, pwd, pwd->pw_uid,
634 sizeof(tbuf), "%s/%s", _PATH_MAILDIR, pwd->pw_name);
644 (void)strlcpy(tbuf + 1, (p = strrchr(pwd->pw_shell, '/')) ?
645 p + 1 : pwd->pw_shell, sizeof(tbuf) - 1);
653 execlp(pwd->pw_shell, tbuf, NULL);
654 err(EXIT_FAILURE, "%s", pwd->pw_shell);