/freebsd/lib/libc/gen/ |
H A D | pw_scan.c | 81 __pw_scan(char *bp, struct passwd *pw, int flags) in __pw_scan() argument 91 pw->pw_fields = 0; in __pw_scan() 92 if (!(pw->pw_name = strsep(&bp, ":"))) /* login */ in __pw_scan() 94 root = !strcmp(pw->pw_name, "root"); in __pw_scan() 95 if (pw->pw_name[0] && (pw->pw_name[0] != '+' || pw->pw_name[1] == '\0')) in __pw_scan() 96 pw->pw_fields |= _PWF_NAME; in __pw_scan() 98 if (!(pw->pw_passwd = strsep(&bp, ":"))) /* passwd */ in __pw_scan() 100 if (pw->pw_passwd[0]) in __pw_scan() 101 pw->pw_fields |= _PWF_PASSWD; in __pw_scan() 106 pw->pw_fields |= _PWF_UID; in __pw_scan() [all …]
|
/freebsd/usr.bin/id/ |
H A D | id.c | 66 struct passwd *pw; in main() local 147 pw = *argv ? who(*argv) : NULL; in main() 149 if (Mflag && pw != NULL) in main() 168 id = pw ? pw->pw_gid : rflag ? getgid() : getegid(); in main() 177 id = pw ? pw->pw_uid : rflag ? getuid() : geteuid(); in main() 178 if (nflag && (pw = getpwuid(id))) in main() 179 (void)printf("%s\n", pw->pw_name); in main() 186 group(pw, nflag); in main() 196 pline(pw); in main() 201 pretty(pw); in main() [all …]
|
/freebsd/crypto/openssh/ |
H A D | uidswap.c | 61 temporarily_use_uid(struct passwd *pw) in temporarily_use_uid() argument 68 (u_int)pw->pw_uid, (u_int)pw->pw_gid, in temporarily_use_uid() 100 if (user_groupslen == -1 || user_groups_uid != pw->pw_uid) { in temporarily_use_uid() 101 if (initgroups(pw->pw_name, pw->pw_gid) == -1) in temporarily_use_uid() 102 fatal("initgroups: %s: %.100s", pw->pw_name, in temporarily_use_uid() 117 user_groups_uid = pw->pw_uid; in temporarily_use_uid() 130 if (setegid(pw->pw_gid) == -1) in temporarily_use_uid() 131 fatal("setegid %u: %.100s", (u_int)pw->pw_gid, in temporarily_use_uid() 133 if (seteuid(pw->pw_uid) == -1) in temporarily_use_uid() 134 fatal("seteuid %u: %.100s", (u_int)pw->pw_uid, in temporarily_use_uid() [all …]
|
H A D | auth-rhosts.c | 192 auth_rhosts2(struct passwd *pw, const char *client_user, const char *hostname, in auth_rhosts2() argument 205 temporarily_use_uid(pw); in auth_rhosts2() 216 pw->pw_dir, rhosts_files[rhosts_file_index]); in auth_rhosts2() 240 if (pw->pw_uid == 0) in auth_rhosts2() 244 client_user, pw->pw_name)) { in auth_rhosts2() 250 client_user, pw->pw_name)) { in auth_rhosts2() 261 if (stat(pw->pw_dir, &st) == -1) { in auth_rhosts2() 263 "no home directory %.200s", pw->pw_name, pw->pw_dir); in auth_rhosts2() 265 "no home directory %.200s", pw->pw_name, pw->pw_dir); in auth_rhosts2() 269 ((st.st_uid != 0 && st.st_uid != pw->pw_uid) || in auth_rhosts2() [all …]
|
H A D | auth.c | 101 allowed_user(struct ssh *ssh, struct passwd * pw) in allowed_user() argument 109 if (!pw || !pw->pw_name) in allowed_user() 112 if (!options.use_pam && platform_locked_account(pw)) { in allowed_user() 114 pw->pw_name); in allowed_user() 124 char *shell = xstrdup((pw->pw_shell[0] == '\0') ? in allowed_user() 125 _PATH_BSHELL : pw->pw_shell); /* empty = /bin/sh */ in allowed_user() 129 "does not exist", pw->pw_name, shell); in allowed_user() 136 "is not executable", pw->pw_name, shell); in allowed_user() 152 r = match_user(pw->pw_name, hostname, ipaddr, in allowed_user() 160 pw->pw_name, hostname); in allowed_user() [all …]
|
H A D | platform.c | 99 platform_setusercontext(struct passwd *pw) in platform_setusercontext() argument 113 solaris_set_default_project(pw); in platform_setusercontext() 136 if (getluid() == -1 && setluid(pw->pw_uid) == -1) in platform_setusercontext() 147 platform_setusercontext_post_groups(struct passwd *pw) in platform_setusercontext_post_groups() argument 162 irix_setusercontext(pw); in platform_setusercontext_post_groups() 166 aix_usrinfo(pw); in platform_setusercontext_post_groups() 183 if (setpcred(pw->pw_name, creds) == -1) in platform_setusercontext_post_groups() 188 ssh_selinux_setup_exec_context(pw->pw_name); in platform_setusercontext_post_groups() 204 platform_locked_account(struct passwd *pw) in platform_locked_account() argument 207 char *passwd = pw->pw_passwd; in platform_locked_account() [all …]
|
/freebsd/contrib/netbsd-tests/kernel/arch/amd64/ |
H A D | t_ptrace_wait.c | 215 struct ptrace_watchpoint pw; in ATF_TC_BODY() local 216 int len = sizeof(pw); in ATF_TC_BODY() 244 pw.pw_index = i; in ATF_TC_BODY() 245 ATF_REQUIRE(ptrace(PT_READ_WATCHPOINT, child, &pw, len) != -1); in ATF_TC_BODY() 248 printf("\t.pw_index=%d\n", pw.pw_index); in ATF_TC_BODY() 249 printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); in ATF_TC_BODY() 250 printf("\t.pw_type=%#x\n", pw.pw_type); in ATF_TC_BODY() 251 printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); in ATF_TC_BODY() 252 printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); in ATF_TC_BODY() 253 printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); in ATF_TC_BODY() [all …]
|
/freebsd/usr.bin/chpass/ |
H A D | field.c | 59 p_login(char *p, struct passwd *pw, ENTRY *ep __unused) in p_login() argument 69 if (!(pw->pw_name = strdup(p))) { in p_login() 85 p_passwd(char *p, struct passwd *pw, ENTRY *ep __unused) in p_passwd() argument 87 if (!(pw->pw_passwd = strdup(p))) { in p_passwd() 97 p_uid(char *p, struct passwd *pw, ENTRY *ep __unused) in p_uid() argument 116 pw->pw_uid = id; in p_uid() 122 p_gid(char *p, struct passwd *pw, ENTRY *ep __unused) in p_gid() argument 137 pw->pw_gid = gr->gr_gid; in p_gid() 146 pw->pw_gid = id; in p_gid() 152 p_class(char *p, struct passwd *pw, ENTRY *ep __unused) in p_class() argument [all …]
|
H A D | edit.c | 61 static int display(const char *tfn, struct passwd *pw); 62 static struct passwd *verify(const char *tfn, struct passwd *pw); 65 edit(const char *tfn, struct passwd *pw) in edit() argument 71 if (display(tfn, pw) == -1) in edit() 78 return (pw_dup(pw)); in edit() 82 if ((npw = verify(tfn, pw)) != NULL) in edit() 102 display(const char *tfn, struct passwd *pw) in display() argument 113 "#Changing user information for %s.\n", pw->pw_name); in display() 115 (void)fprintf(fp, "Login: %s\n", pw->pw_name); in display() 116 (void)fprintf(fp, "Password: %s\n", pw->pw_passwd); in display() [all …]
|
H A D | chpass.c | 70 struct passwd lpw, *old_pw, *pw; in main() local 80 pw = old_pw = NULL; in main() 132 if ((pw = getpwuid(uid)) == NULL) in main() 136 if ((pw = getpwnam(*argv)) == NULL) in main() 138 if (uid != 0 && uid != pw->pw_uid) in main() 143 if ((pw = pw_dup(pw)) == NULL || in main() 144 (old_pw = pw_dup(pw)) == NULL) in main() 149 if (pw != NULL && (pw->pw_fields & _PWF_SOURCE) == _PWF_NIS) { in main() 163 if (p_shell(arg, pw, (ENTRY *)NULL) == -1) in main() 170 if (p_expire(arg, pw, (ENTRY *)NULL) == -1) in main() [all …]
|
/freebsd/lib/libutil/ |
H A D | pw_util.c | 396 pw_make(const struct passwd *pw) in pw_make() argument 400 asprintf(&line, "%s:%s:%ju:%ju:%s:%ju:%ju:%s:%s:%s", pw->pw_name, in pw_make() 401 pw->pw_passwd, (uintmax_t)pw->pw_uid, (uintmax_t)pw->pw_gid, in pw_make() 402 pw->pw_class, (uintmax_t)pw->pw_change, (uintmax_t)pw->pw_expire, in pw_make() 403 pw->pw_gecos, pw->pw_dir, pw->pw_shell); in pw_make() 411 pw_make_v7(const struct passwd *pw) in pw_make_v7() argument 415 asprintf(&line, "%s:*:%ju:%ju:%s:%s:%s", pw->pw_name, in pw_make_v7() 416 (uintmax_t)pw->pw_uid, (uintmax_t)pw->pw_gid, in pw_make_v7() 417 pw->pw_gecos, pw->pw_dir, pw->pw_shell); in pw_make_v7() 426 pw_copy(int ffd, int tfd, const struct passwd *pw, struct passwd *old_pw) in pw_copy() argument [all …]
|
/freebsd/contrib/libpcap/ |
H A D | pcap-npf.c | 247 struct pcap_win *pw = p->priv; in pcap_stats_npf() local 263 if (!PacketGetStats(pw->adapter, &bstats)) { in pcap_stats_npf() 308 struct pcap_win *pw = p->priv; in pcap_stats_ex_npf() local 320 if (!PacketGetStatsEx(pw->adapter, &bstats)) { in pcap_stats_ex_npf() 343 struct pcap_win *pw = p->priv; in pcap_setbuff_npf() local 345 if(PacketSetBuff(pw->adapter,dim)==FALSE) in pcap_setbuff_npf() 357 struct pcap_win *pw = p->priv; in pcap_setmode_npf() local 359 if(PacketSetMode(pw->adapter,mode)==FALSE) in pcap_setmode_npf() 372 struct pcap_win *pw = p->priv; in pcap_setmintocopy_npf() local 374 if(PacketSetMinToCopy(pw->adapter, size)==FALSE) in pcap_setmintocopy_npf() [all …]
|
/freebsd/crypto/heimdal/lib/asn1/ |
H A D | setchgpw2.asn1 | 40 Req-change-pw ::= SEQUENCE { 41 old-pw[0] UTF8String, 42 new-pw[1] UTF8String OPTIONAL, 47 Rep-change-pw ::= SEQUENCE { 49 new-pw[1] UTF8String OPTIONAL, 53 Err-change-pw ::= SEQUENCE { 57 wont-generate-new-pw(1), 58 old-pw-incorrect(2), 59 new-pw-rejected-geneneric(3), 60 pw-change-too-short(4), [all …]
|
/freebsd/contrib/openbsm/bin/auditdistd/ |
H A D | sandbox.c | 70 struct passwd *pw; in sandbox() local 96 pw = getpwnam(user); in sandbox() 97 if (pw == NULL) { in sandbox() 122 if (getgrouplist(user, pw->pw_gid, groups, &ngroups) == -1) { in sandbox() 137 jailst.path = pw->pw_dir; in sandbox() 144 "Unable to jail to directory %s", pw->pw_dir); in sandbox() 152 if (chroot(pw->pw_dir) == -1) { in sandbox() 155 pw->pw_dir); in sandbox() 165 if (setgid(pw->pw_gid) == -1) { in sandbox() 167 (unsigned int)pw->pw_gid); in sandbox() [all …]
|
/freebsd/lib/libcrypt/ |
H A D | crypt-md5.c | 45 crypt_md5(const char *pw, const char *salt, char *buffer) in crypt_md5() argument 69 MD5Update(&ctx, (const u_char *)pw, strlen(pw)); in crypt_md5() 79 MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); in crypt_md5() 81 MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); in crypt_md5() 83 for(pl = (int)strlen(pw); pl > 0; pl -= MD5_SIZE) in crypt_md5() 91 for (i = strlen(pw); i; i >>= 1) in crypt_md5() 95 MD5Update(&ctx, (const u_char *)pw, 1); in crypt_md5() 112 MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); in crypt_md5() 120 MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); in crypt_md5() 125 MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); in crypt_md5()
|
/freebsd/sbin/hastd/ |
H A D | subr.c | 156 struct passwd *pw; in drop_privs() local 168 pw = getpwnam(HAST_USER); in drop_privs() 169 if (pw == NULL) { in drop_privs() 183 jailst.path = pw->pw_dir; in drop_privs() 201 "Unable to jail to directory to %s", pw->pw_dir); in drop_privs() 202 if (chroot(pw->pw_dir) == -1) { in drop_privs() 205 pw->pw_dir); in drop_privs() 210 gidset[0] = pw->pw_gid; in drop_privs() 213 (unsigned int)pw->pw_gid); in drop_privs() 216 if (setgid(pw->pw_gid) == -1) { in drop_privs() [all …]
|
/freebsd/contrib/kyua/utils/ |
H A D | passwd.cpp | 127 const struct ::passwd* pw = ::getpwnam(name.c_str()); in find_user_by_name() local 128 if (pw == NULL) in find_user_by_name() 131 INV(pw->pw_name == name); in find_user_by_name() 132 return user(pw->pw_name, pw->pw_uid, pw->pw_gid); in find_user_by_name() 156 const struct ::passwd* pw = ::getpwuid(uid); in find_user_by_uid() local 157 if (pw == NULL) in find_user_by_uid() 160 INV(pw->pw_uid == uid); in find_user_by_uid() 161 return user(pw->pw_name, pw->pw_uid, pw->pw_gid); in find_user_by_uid()
|
/freebsd/usr.bin/finger/ |
H A D | util.c | 58 match(struct passwd *pw, const char *user) in match() argument 63 if (!strcasecmp(pw->pw_name, user)) in match() 70 (void)strncpy(p = tbuf, pw->pw_gecos, sizeof(tbuf)); in match() 81 (void)strncpy(t, pw->pw_name, in match() 148 enter_person(struct passwd *pw) in enter_person() argument 157 key.data = pw->pw_name; in enter_person() 158 key.size = strlen(pw->pw_name); in enter_person() 171 userinfo(pn, pw); in enter_person() 185 struct passwd *pw; in find_person() local 193 if ((pw = getpwnam(name)) && hide(pw)) in find_person() [all …]
|
H A D | finger.c | 149 struct passwd *pw; in main() local 154 if ((pw = getpwnam(UNPRIV_NAME)) && pw->pw_uid > 0) { in main() 155 if (setgid(pw->pw_gid) != 0) in main() 157 if (setuid(pw->pw_uid) != 0) in main() 223 struct passwd *pw; in loginlist() local 235 if ((pw = getpwnam(user->ut_user)) == NULL) in loginlist() 237 if (hide(pw)) in loginlist() 239 pn = enter_person(pw); in loginlist() 264 struct passwd *pw; in userlist() local 332 if (((pw = getpwnam(*p)) != NULL) && !hide(pw)) in userlist() [all …]
|
/freebsd/crypto/heimdal/kadmin/ |
H A D | random_password.c | 50 static void generate_password(char **pw, int num_classes, ...); 54 random_password(char *pw, size_t len) in random_password() argument 61 otp_print_stddict (newkey, pw, len); in random_password() 62 strlwr(pw); in random_password() 70 strlcpy(pw, pass, len); in random_password() 112 generate_password(char **pw, int num_classes, ...) in generate_password() argument 124 *pw = NULL; in generate_password() 138 *pw = malloc(len + 1); in generate_password() 139 if(*pw == NULL) { in generate_password() 149 (*pw)[i] = classes[j].str[RND(rbuf, sizeof(rbuf), &rleft) in generate_password() [all …]
|
/freebsd/contrib/libarchive/libarchive/ |
H A D | archive_string_sprintf.c | 97 const wchar_t *pw; in archive_string_vsprintf() 147 pw = va_arg(ap, wchar_t *); in archive_string_vsprintf() 148 if (pw == NULL) in archive_string_vsprintf() 149 pw = L"(null)"; in archive_string_vsprintf() 150 if (archive_string_append_from_wcs(as, pw, in archive_string_vsprintf() 151 wcslen(pw)) != 0 && errno == ENOMEM) in archive_string_vsprintf() 163 pw = va_arg(ap, wchar_t *); in archive_string_vsprintf() 164 if (pw == NULL) in archive_string_vsprintf() 165 pw = L"(null)"; in archive_string_vsprintf() 166 if (archive_string_append_from_wcs(as, pw, in archive_string_vsprintf() 98 const wchar_t *pw; archive_string_vsprintf() local [all...] |
/freebsd/usr.bin/env/ |
H A D | env.c | 65 struct passwd *pw; in main() local 76 pw = NULL; in main() 137 pw = getpwnam(login_name); in main() 138 if (pw == NULL) { in main() 143 pw = getpwuid(uid); in main() 145 if (pw == NULL) in main() 159 lc = login_getpwclass(pw); in main() 168 setclassenvironment(lc, pw, 1); in main() 169 setclassenvironment(lc, pw, 0); in main() 172 if ((lc = login_getuserclass(pw)) != NULL) { in main() [all …]
|
/freebsd/crypto/openssh/openbsd-compat/ |
H A D | xcrypt.c | 73 struct passwd *pw; in pick_salt() local 82 while ((pw = getpwent()) != NULL) { in pick_salt() 83 if ((passwd = shadow_pw(pw)) == NULL) in pick_salt() 129 shadow_pw(struct passwd *pw) in shadow_pw() argument 131 char *pw_password = pw->pw_passwd; in shadow_pw() 134 struct spwd *spw = getspnam(pw->pw_name); in shadow_pw() 141 return(get_iaf_password(pw)); in shadow_pw() 146 if (issecure() && (spw = getpwanam(pw->pw_name)) != NULL) in shadow_pw() 149 struct pr_passwd *spw = getprpwnam(pw->pw_name); in shadow_pw()
|
/freebsd/usr.sbin/rpc.yppasswdd/ |
H A D | yppasswdd_server.c | 247 find_domain(struct x_passwd *pw) in find_domain() argument 276 key.data = pw->pw_name; in find_domain() 277 key.size = strlen(pw->pw_name); in find_domain() 285 if (yp_password.pw_uid == (uid_t)pw->pw_uid && in find_domain() 286 yp_password.pw_gid == (gid_t)pw->pw_gid) { in find_domain() 316 update_inplace(struct passwd *pw, char *domain) in update_inplace() argument 336 "%llu", (unsigned long long)pw->pw_uid); in update_inplace() 340 key.data = pw->pw_name; in update_inplace() 341 key.size = strlen(pw->pw_name); in update_inplace() 377 if (strncmp(data.data, pw->pw_name, in update_inplace() [all …]
|
/freebsd/crypto/heimdal/kdc/ |
H A D | main.c | 75 struct passwd *pw; in switch_environment() local 77 pw = getpwnam(runas_string); in switch_environment() 78 if (pw == NULL) in switch_environment() 81 if (initgroups(pw->pw_name, pw->pw_gid) < 0) in switch_environment() 85 if (setgid(pw->pw_gid) < 0) in switch_environment() 88 if (setuid(pw->pw_uid) < 0) in switch_environment() 96 if (capng_change_id(pw->pw_uid, pw->pw_gid, in switch_environment()
|