Lines Matching refs:pw

99 allowed_user(struct passwd * pw)  in allowed_user()  argument
109 if (!pw || !pw->pw_name) in allowed_user()
114 spw = getspnam(pw->pw_name); in allowed_user()
122 passwd = pw->pw_passwd; in allowed_user()
126 passwd = get_iaf_password(pw); in allowed_user()
154 pw->pw_name); in allowed_user()
165 char *shell = xstrdup((pw->pw_shell[0] == '\0') ? in allowed_user()
166 _PATH_BSHELL : pw->pw_shell); /* empty = /bin/sh */ in allowed_user()
170 "does not exist", pw->pw_name, shell); in allowed_user()
177 "is not executable", pw->pw_name, shell); in allowed_user()
193 if (match_user(pw->pw_name, hostname, ipaddr, in allowed_user()
197 pw->pw_name, hostname); in allowed_user()
204 if (match_user(pw->pw_name, hostname, ipaddr, in allowed_user()
210 "not listed in AllowUsers", pw->pw_name, hostname); in allowed_user()
216 if (ga_init(pw->pw_name, pw->pw_gid) == 0) { in allowed_user()
218 "not in any group", pw->pw_name, hostname); in allowed_user()
229 pw->pw_name, hostname); in allowed_user()
242 "in AllowGroups", pw->pw_name, hostname); in allowed_user()
249 if (!sys_auth_allowed_user(pw, &loginmsg)) in allowed_user()
364 expand_authorized_keys(const char *filename, struct passwd *pw) in expand_authorized_keys() argument
369 file = percent_expand(filename, "h", pw->pw_dir, in expand_authorized_keys()
370 "u", pw->pw_name, (char *)NULL); in expand_authorized_keys()
379 i = snprintf(ret, sizeof(ret), "%s/%s", pw->pw_dir, file); in expand_authorized_keys()
387 authorized_principals_file(struct passwd *pw) in authorized_principals_file() argument
392 return expand_authorized_keys(options.authorized_principals_file, pw); in authorized_principals_file()
397 check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host, in check_key_in_hostfiles() argument
409 user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); in check_key_in_hostfiles()
412 ((st.st_uid != 0 && st.st_uid != pw->pw_uid) || in check_key_in_hostfiles()
416 pw->pw_name, user_hostfile); in check_key_in_hostfiles()
420 temporarily_use_uid(pw); in check_key_in_hostfiles()
519 secure_filename(FILE *f, const char *file, struct passwd *pw, in secure_filename() argument
530 return auth_secure_path(file, &st, pw->pw_dir, pw->pw_uid, err, errlen); in secure_filename()
534 auth_openfile(const char *file, struct passwd *pw, int strict_modes, in auth_openfile() argument
555 pw->pw_name, file_type, file); in auth_openfile()
565 secure_filename(f, file, pw, line, sizeof(line)) != 0) { in auth_openfile()
577 auth_openkeyfile(const char *file, struct passwd *pw, int strict_modes) in auth_openkeyfile() argument
579 return auth_openfile(file, pw, strict_modes, 1, "authorized keys"); in auth_openkeyfile()
583 auth_openprincipals(const char *file, struct passwd *pw, int strict_modes) in auth_openprincipals() argument
585 return auth_openfile(file, pw, strict_modes, 0, in auth_openprincipals()
598 struct passwd *pw; in getpwnamallow() local
608 pw = getpwnam(user); in getpwnamallow()
620 if (pw != NULL && strcmp(user, pw->pw_name) != 0) { in getpwnamallow()
622 user, pw->pw_name); in getpwnamallow()
623 pw = NULL; in getpwnamallow()
626 if (pw == NULL) { in getpwnamallow()
638 if (!allowed_user(pw)) in getpwnamallow()
641 if ((lc = login_getpwclass(pw)) == NULL) { in getpwnamallow()
646 if ((as = auth_open()) == NULL || auth_setpwd(as, pw) != 0 || in getpwnamallow()
647 auth_approval(as, lc, pw->pw_name, "ssh") <= 0) { in getpwnamallow()
649 pw = NULL; in getpwnamallow()
655 if (pw != NULL) in getpwnamallow()
656 return (pwcopy(pw)); in getpwnamallow()