Lines Matching refs:pw
422 struct passwd *pw; in extract_pw_data() local
433 pw = getpwuid(uid); in extract_pw_data()
435 if (!(pw && pw->pw_name && pw->pw_name[0] && pw->pw_shell in extract_pw_data()
436 && pw->pw_shell[0] && pw->pw_dir && pw->pw_dir[0])) { in extract_pw_data()
442 *pw_copy = *pw; in extract_pw_data()
443 pw = pw_copy; in extract_pw_data()
444 pw->pw_name = strdup(pw->pw_name); in extract_pw_data()
445 pw->pw_dir = strdup(pw->pw_dir); in extract_pw_data()
446 pw->pw_shell = strdup(pw->pw_shell); in extract_pw_data()
448 if (!(pw->pw_name && pw->pw_dir && pw->pw_shell)) { in extract_pw_data()
453 if (verify_shell(pw->pw_shell) == 0) { in extract_pw_data()
460 free(pw->pw_name); in extract_pw_data()
461 free(pw->pw_dir); in extract_pw_data()
462 free(pw->pw_shell); in extract_pw_data()
477 char **old_environ, const struct passwd *pw) in restore_environment() argument
522 rc |= setenv("HOME", pw->pw_dir, 1); in restore_environment()
523 rc |= setenv("SHELL", pw->pw_shell, 1); in restore_environment()
524 rc |= setenv("USER", pw->pw_name, 1); in restore_environment()
525 rc |= setenv("LOGNAME", pw->pw_name, 1); in restore_environment()
1030 struct passwd pw; /* struct derived from passwd file line */ in main() local
1117 if (extract_pw_data(&pw)) in main()
1146 pam_status = pam_start(service_name, pw.pw_name, &pam_conversation, in main()
1155 if (!authenticate_via_shadow_passwd(pw.pw_name)) in main()
1159 pw.pw_name); in main()
1238 free(pw.pw_name); in main()
1239 free(pw.pw_dir); in main()
1240 free(pw.pw_shell); in main()
1283 if (asprintf(&shell_argv0, "-%s", pw.pw_shell) < 0) { in main()
1324 if (restore_environment(preserve_environment, old_environ, &pw)) { in main()
1329 execv(pw.pw_shell, argv + optind - 1); in main()
1356 free(pw.pw_name); in main()
1357 free(pw.pw_dir); in main()
1358 free(pw.pw_shell); in main()