Lines Matching refs:pwd

62 #include <pwd.h>
254 if (failures > (pwd ? 0 : 1))
296 pwd = NULL;
297 (void)getpwnam_r(username, &pwres, pwbuf, sizeof(pwbuf), &pwd);
301 * within the next block. pwd can be NULL since it
304 lc = login_getclass(pwd ? pwd->pw_class : NULL);
312 if (pwd) {
313 if (pwd->pw_uid == 0)
316 if (fflag && (uid == 0 || uid == pwd->pw_uid)) {
329 * username, pwd, and lc.
340 pwd = NULL;
342 &pwd);
343 lc = login_getpwclass(pwd);
388 if (pwd && auth_passed)
425 (void)setegid(pwd->pw_gid);
426 initgroups(username, pwd->pw_gid);
427 (void)seteuid(pwd->pw_uid);
429 if (chdir(pwd->pw_dir) != 0) {
432 pwd->pw_dir);
437 (void)printf("No home directory %s!\n", pwd->pw_dir);
442 pwd->pw_dir = __UNCONST("/");
457 (void)chown(ttyn, pwd->pw_uid,
458 (grp != NULL) ? grp->gr_gid : pwd->pw_gid);
460 if (ttyaction(ttyn, "login", pwd->pw_name))
466 if (nested == NULL && setusercontext(lc, pwd, pwd->pw_uid,
474 syslog(LOG_INFO, "DIALUP %s, %s", tty, pwd->pw_name);
480 if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETGROUP) != 0) {
570 if (*pwd->pw_shell == '\0')
571 pwd->pw_shell = __UNCONST(_PATH_BSHELL);
573 shell = login_getcapstr(lc, "shell", pwd->pw_shell, pwd->pw_shell);
575 shell = pwd->pw_shell;
577 if ((pwd->pw_shell = strdup(shell)) == NULL) {
582 (void)setenv("HOME", pwd->pw_dir, 1);
583 (void)setenv("SHELL", pwd->pw_shell, 1);
594 (void)setenv("LOGNAME", pwd->pw_name, 1);
595 (void)setenv("USER", pwd->pw_name, 1);
612 if (setusercontext(lc, pwd, pwd->pw_uid,
633 sizeof(tbuf), "%s/%s", _PATH_MAILDIR, pwd->pw_name);
643 (void)strlcpy(tbuf + 1, (p = strrchr(pwd->pw_shell, '/')) ?
644 p + 1 : pwd->pw_shell, sizeof(tbuf) - 1);
652 execlp(pwd->pw_shell, tbuf, NULL);
653 err(EXIT_FAILURE, "%s", pwd->pw_shell);