Home | History | Annotate | Download | only in su

Lines Matching refs:pwd

54 #include <pwd.h>
102 struct passwd *pwd, pwres;
181 getpwnam_r(username, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0 ||
182 pwd == NULL || pwd->pw_uid != ruid) {
183 if (getpwuid_r(ruid, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0)
184 pwd = NULL;
186 if (pwd == NULL)
188 username = estrdup(pwd->pw_name);
191 if (pwd->pw_shell && *pwd->pw_shell) {
192 (void)estrlcpy(shellbuf, pwd->pw_shell, sizeof(shellbuf));
217 if (getpwnam_r(user, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0 ||
218 pwd == NULL)
278 * refresh pwd and user
286 if (getpwnam_r(user, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0 ||
287 pwd == NULL) {
309 pwd->pw_class = class;
312 if ((lc = login_getclass(pwd->pw_class)) == NULL)
314 "Unknown class %s\n", pwd->pw_class));
318 if (chshell(pwd->pw_shell) == 0 && ruid)
321 } else if (pwd->pw_shell && *pwd->pw_shell) {
322 shell = pwd->pw_shell;
344 if (ruid != pwd->pw_uid &&
345 setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETGROUP) == -1)
349 addgroup(lc, gname, pwd, ruid, "Group Password:");
492 if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETPATH |
499 if (asthem || pwd->pw_uid) {
500 (void)setenv("LOGNAME", pwd->pw_name, 1);
501 (void)setenv("USER", pwd->pw_name, 1);
503 (void)setenv("HOME", pwd->pw_dir, 1);
532 username, pwd->pw_name, ontty());
548 if ((asme || (!asthem && class == NULL)) && pwd->pw_uid)
551 if (setusercontext(lc, pwd, pwd->pw_uid, setwhat) == -1)
556 if (gohome && chdir(pwd->pw_dir) == -1)