Lines Matching defs:pwd
53 #include <pwd.h>
74 /* Counter as stored in /etc/pwd.db */
262 struct passwd *pwd;
284 pwd = va_arg(ap, struct passwd *);
289 strlen(pwd->pw_name) + 1;
290 if (pwd->pw_passwd != NULL)
291 desired_size += strlen(pwd->pw_passwd) + 1;
292 if (pwd->pw_class != NULL)
293 desired_size += strlen(pwd->pw_class) + 1;
294 if (pwd->pw_gecos != NULL)
295 desired_size += strlen(pwd->pw_gecos) + 1;
296 if (pwd->pw_dir != NULL)
297 desired_size += strlen(pwd->pw_dir) + 1;
298 if (pwd->pw_shell != NULL)
299 desired_size += strlen(pwd->pw_shell) + 1;
307 memcpy(&new_pwd, pwd, sizeof(struct passwd));
366 struct passwd *pwd;
387 pwd = va_arg(ap, struct passwd *);
398 memcpy(pwd, buffer, sizeof(struct passwd));
403 NS_APPLY_OFFSET(pwd->pw_name, orig_buf, p, char *);
404 NS_APPLY_OFFSET(pwd->pw_passwd, orig_buf, p, char *);
405 NS_APPLY_OFFSET(pwd->pw_class, orig_buf, p, char *);
406 NS_APPLY_OFFSET(pwd->pw_gecos, orig_buf, p, char *);
407 NS_APPLY_OFFSET(pwd->pw_dir, orig_buf, p, char *);
408 NS_APPLY_OFFSET(pwd->pw_shell, orig_buf, p, char *);
411 *((struct passwd **)retval) = pwd;
503 getpwent_r(struct passwd *pwd, char *buffer, size_t bufsize,
528 pwd_init(pwd);
532 pwd, buffer, bufsize, &ret_errno);
541 getpwnam_r(const char *name, struct passwd *pwd, char *buffer, size_t bufsize,
567 pwd_init(pwd);
571 name, pwd, buffer, bufsize, &ret_errno);
580 getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize,
606 pwd_init(pwd);
610 uid, pwd, buffer, bufsize, &ret_errno);
619 pwd_init(struct passwd *pwd)
623 memset(pwd, 0, sizeof(*pwd));
624 pwd->pw_uid = (uid_t)-1; /* Considered least likely to lead to */
625 pwd->pw_gid = (gid_t)-1; /* a security issue. */
626 pwd->pw_name = nul;
627 pwd->pw_passwd = nul;
628 pwd->pw_class = nul;
629 pwd->pw_gecos = nul;
630 pwd->pw_dir = nul;
631 pwd->pw_shell = nul;
635 static struct passwd pwd;
654 rv = fn(key, &pwd, pwd_storage, pwd_storage_size, &res);
675 wrap_getpwnam_r(union key key, struct passwd *pwd, char *buffer,
678 return (getpwnam_r(key.name, pwd, buffer, bufsize, res));
683 wrap_getpwuid_r(union key key, struct passwd *pwd, char *buffer,
686 return (getpwuid_r(key.uid, pwd, buffer, bufsize, res));
691 wrap_getpwent_r(union key key __unused, struct passwd *pwd, char *buffer,
694 return (getpwent_r(pwd, buffer, bufsize, res));
813 struct passwd *pwd;
839 pwd = va_arg(ap, struct passwd *);
920 rv = pwdb_versions[st->version].parse(buffer, entry.size, pwd,
929 pwd->pw_fields &= ~_PWF_SOURCE;
930 pwd->pw_fields |= _PWF_FILES;
932 *(struct passwd **)retval = pwd;
966 pwdb_parse_entry_v3(char *buffer, size_t bufsize, struct passwd *pwd,
989 STRING(pwd->pw_name);
990 STRING(pwd->pw_passwd);
991 SCALAR(pwd->pw_uid);
992 SCALAR(pwd->pw_gid);
994 STRING(pwd->pw_class);
995 STRING(pwd->pw_gecos);
996 STRING(pwd->pw_dir);
997 STRING(pwd->pw_shell);
999 SCALAR(pwd->pw_fields);
1002 pwd->pw_change = pw_change;
1003 pwd->pw_expire = pw_expire;
1037 pwdb_parse_entry_v4(char *buffer, size_t bufsize, struct passwd *pwd,
1061 STRING(pwd->pw_name);
1062 STRING(pwd->pw_passwd);
1063 SCALAR(pwd->pw_uid);
1064 SCALAR(pwd->pw_gid);
1065 SCALAR(pwd->pw_change);
1066 STRING(pwd->pw_class);
1067 STRING(pwd->pw_gecos);
1068 STRING(pwd->pw_dir);
1069 STRING(pwd->pw_shell);
1070 SCALAR(pwd->pw_expire);
1071 SCALAR(pwd->pw_fields);
1108 struct passwd *pwd;
1132 pwd = va_arg(ap, struct passwd *);
1188 rv = __pw_parse_entry(buffer, bufsize, pwd, 0, errnop);
1196 pwd->pw_fields &= ~_PWF_SOURCE;
1197 pwd->pw_fields |= _PWF_HESIOD;
1199 *(struct passwd **)retval = pwd;
1304 struct passwd *pwd;
1325 pwd = va_arg(ap, struct passwd *);
1404 rv = __pw_parse_entry(buffer, resultlen, pwd, master,
1409 if (strstr(pwd->pw_passwd, "##") != NULL) {
1410 rv = nis_adjunct(st->domain, pwd->pw_name,
1415 pwd->pw_passwd = &buffer[resultlen+1];
1417 pwd->pw_fields &= ~_PWF_SOURCE;
1418 pwd->pw_fields |= _PWF_NIS;
1420 *(struct passwd **)retval = pwd;
1478 compat_use_template(struct passwd *pwd, struct passwd *template, char *buffer,
1491 n += pwd->pw_name != NULL ? strlen(pwd->pw_name) + 1 : 0;
1492 n += pwd->pw_passwd != NULL ? strlen(pwd->pw_passwd) + 1 : 0;
1493 n += pwd->pw_class != NULL ? strlen(pwd->pw_class) + 1 : 0;
1494 n += pwd->pw_gecos != NULL ? strlen(pwd->pw_gecos) + 1 : 0;
1495 n += pwd->pw_dir != NULL ? strlen(pwd->pw_dir) + 1 : 0;
1496 n += pwd->pw_shell != NULL ? strlen(pwd->pw_shell) + 1 : 0;
1505 if (pwd->field == NULL) \
1509 p += strlcpy(p, pwd->field, eob-p) + 1; \
1524 pwd->field = NULL; \
1526 pwd->field = p; \
1547 pwd->field = template->field; \
1592 uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, int *errnop)
1615 pwd_init(pwd);
1619 "getpwent_r", compatsrc, pwd, buffer, bufsize,
1624 "getpwuid_r", compatsrc, uid, pwd, buffer,
1629 "getpwnam_r", compatsrc, lookup_name, pwd, buffer,
1637 if (compat_is_excluded(pwd->pw_name, st->exclude)) {
1642 e = compat_use_template(pwd, &st->template, buffer, bufsize);
1652 if (strcmp(name, pwd->pw_name) != 0)
1656 if (uid != pwd->pw_uid)
1749 struct passwd *pwd;
1774 pwd = va_arg(ap, struct passwd *);
1805 rv = compat_redispatch(st, how, how, name, name, uid, pwd,
1822 user, uid, pwd, buffer, bufsize, errnop);
1828 uid, pwd, buffer, bufsize, errnop);
1892 entry.size, pwd, errnop);
1895 else if (compat_set_template(pwd, &st->template) < 0) {
1938 rv = pwdb_versions[st->version].parse(buffer, entry.size, pwd,
1950 pwd->pw_fields &= ~_PWF_SOURCE;
1951 pwd->pw_fields |= _PWF_FILES;
1954 *(struct passwd **)retval = pwd;
2002 __pw_parse_entry(char *buffer, size_t bufsize __unused, struct passwd *pwd,
2006 if (__pw_scan(buffer, pwd, master ? _PWSCAN_MASTER : 0) == 0)