Lines Matching refs:pwd
71 struct passwd *pwd; in main() local
146 if (username == NULL || (pwd = getpwnam(username)) == NULL || in main()
147 pwd->pw_uid != ruid) in main()
148 pwd = getpwuid(ruid); in main()
149 if (pwd == NULL) in main()
151 if ((username = strdup(pwd->pw_name)) == NULL) in main()
154 if (pwd->pw_shell && *pwd->pw_shell) { in main()
155 if ((shell = strdup(pwd->pw_shell)) == NULL) in main()
208 if (auth_setpwd(as, NULL) || (pwd = auth_getpwd(as)) == NULL) { in main()
210 pwd = NULL; in main()
216 if (pw_class == NULL && pwd != NULL) in main()
217 pw_class = pwd->pw_class; in main()
223 verify_user(username, pwd, style, lc, as) == 0) in main()
234 if (pwd == NULL) in main()
243 if (ruid && !chshell(pwd->pw_shell)) in main()
245 } else if (pwd->pw_shell && *pwd->pw_shell) { in main()
246 if ((shell = strdup(pwd->pw_shell)) == NULL) in main()
257 if (unveil(pwd->pw_dir, "r") == -1) in main()
258 err(1, "unveil %s", pwd->pw_dir); in main()
274 if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETPATH)) in main()
279 setegid(pwd->pw_gid); in main()
280 seteuid(pwd->pw_uid); in main()
282 homeless = chdir(pwd->pw_dir); in main()
285 auth_err(as, 1, "%s", pwd->pw_dir); in main()
289 printf("No home directory %s!\n", pwd->pw_dir); in main()
297 } else if (pwd->pw_uid == 0) { in main()
299 pwd, pwd->pw_uid, LOGIN_SETPATH|LOGIN_SETUMASK)) in main()
302 if (asthem || pwd->pw_uid) { in main()
303 if (setenv("LOGNAME", pwd->pw_name, 1) == -1 || in main()
304 setenv("USER", pwd->pw_name, 1) == -1) in main()
307 if (setenv("HOME", homeless ? "/" : pwd->pw_dir, 1) == -1 || in main()
363 if (setusercontext(lc, pwd, pwd->pw_uid, flags) != 0) in main()
369 if (pwd->pw_uid && auth_approval(as, lc, pwd->pw_name, "su") == 0) in main()
378 verify_user(char *from, struct passwd *pwd, char *style, in verify_user() argument
390 if ((pwd == NULL || pwd->pw_uid != 0 || style == NULL || in verify_user()
399 if (pwd != NULL && pwd->pw_uid == 0 && (gr = getgrgid(0)) != NULL && in verify_user()