Lines Matching refs:pwd

62 #include <pwd.h>
334 if (failures > (pwd ? 0 : 1))
340 pwd = getpwnam(username);
345 * within the next block. pwd can be NULL since it
348 lc = login_getclass(pwd ? pwd->pw_class : NULL);
356 if (pwd) {
357 if (pwd->pw_uid == 0)
360 if (fflag && (uid == 0 || uid == pwd->pw_uid)) {
367 } else if (pwd->pw_passwd[0] == '\0') {
393 if (pwd == NULL) {
399 k5login(pwd, instance, localhost, p) == 0) {
415 if (!sflag && *pwd->pw_passwd != '\0' &&
416 !strcmp(crypt(p, pwd->pw_passwd), pwd->pw_passwd)) {
433 if (pwd && !rval && rootlogin && !rootterm(tty)) {
439 pwd->pw_name, hostname, tty);
443 pwd->pw_name, tty);
447 if (pwd && !rval)
494 (void)setegid(pwd->pw_gid);
495 initgroups(username, pwd->pw_gid);
496 (void)seteuid(pwd->pw_uid);
498 if (chdir(pwd->pw_dir) < 0) {
502 pwd->pw_dir);
506 (void)printf("No home directory %s!\n", pwd->pw_dir);
509 pwd->pw_dir = __UNCONST("/");
528 if (pwd->pw_expire) {
529 if (now.tv_sec >= pwd->pw_expire) {
532 } else if (pwd->pw_expire - now.tv_sec < pw_warntime &&
535 ctime(&pwd->pw_expire));
537 if (pwd->pw_change) {
538 if (pwd->pw_change == _PASSWORD_CHGNOW)
540 else if (now.tv_sec >= pwd->pw_change) {
543 } else if (pwd->pw_change - now.tv_sec < pw_warntime &&
546 ctime(&pwd->pw_change));
552 (void)chown(ttyn, pwd->pw_uid,
553 (gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid);
555 if (ttyaction(ttyn, "login", pwd->pw_name))
569 if (nested == NULL && setusercontext(lc, pwd, pwd->pw_uid,
574 if (setusercontext(lc, pwd, pwd->pw_uid,
580 (void)setgid(pwd->pw_gid);
582 initgroups(username, pwd->pw_gid);
584 if (nested == NULL && setlogin(pwd->pw_name) < 0)
591 (void)setuid(pwd->pw_uid);
594 if (*pwd->pw_shell == '\0')
595 pwd->pw_shell = __UNCONST(_PATH_BSHELL);
602 pwd->pw_shell = shell;
606 (void)setenv("HOME", pwd->pw_dir, 1);
607 (void)setenv("SHELL", pwd->pw_shell, 1);
618 (void)setenv("LOGNAME", pwd->pw_name, 1);
619 (void)setenv("USER", pwd->pw_name, 1);
622 setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETPATH);
633 syslog(LOG_INFO, "DIALUP %s, %s", tty, pwd->pw_name);
668 sizeof(tbuf), "%s/%s", _PATH_MAILDIR, pwd->pw_name);
684 (void)strlcpy(tbuf + 1, (p = strrchr(pwd->pw_shell, '/')) ?
685 p + 1 : pwd->pw_shell, sizeof(tbuf) - 1);
716 execlp(pwd->pw_shell, tbuf, NULL);
717 err(EXIT_FAILURE, "%s", pwd->pw_shell);