Lines Matching refs:pwd

125 free_passwd(struct passwd *pwd)  in free_passwd()  argument
127 free(pwd->pw_name); in free_passwd()
128 free(pwd->pw_passwd); in free_passwd()
129 free(pwd->pw_class); in free_passwd()
130 free(pwd->pw_gecos); in free_passwd()
131 free(pwd->pw_dir); in free_passwd()
132 free(pwd->pw_shell); in free_passwd()
136 sdump_passwd(struct passwd *pwd, char *buffer, size_t buflen) in sdump_passwd() argument
139 pwd->pw_name, pwd->pw_passwd, pwd->pw_uid, pwd->pw_gid, in sdump_passwd()
140 (uintmax_t)pwd->pw_change, pwd->pw_class, pwd->pw_gecos, in sdump_passwd()
141 pwd->pw_dir, pwd->pw_shell, (uintmax_t)pwd->pw_expire, in sdump_passwd()
142 pwd->pw_fields); in sdump_passwd()
147 dump_passwd(struct passwd *pwd) in dump_passwd() argument
149 if (pwd != NULL) { in dump_passwd()
151 sdump_passwd(pwd, buffer, sizeof(buffer)); in dump_passwd()
159 passwd_read_snapshot_func(struct passwd *pwd, char *line) in passwd_read_snapshot_func() argument
170 memset(pwd, 0, sizeof(struct passwd)); in passwd_read_snapshot_func()
174 pwd->pw_name = strdup(s); in passwd_read_snapshot_func()
175 ATF_REQUIRE(pwd->pw_name != NULL); in passwd_read_snapshot_func()
178 pwd->pw_passwd = strdup(s); in passwd_read_snapshot_func()
179 ATF_REQUIRE(pwd->pw_passwd != NULL); in passwd_read_snapshot_func()
182 pwd->pw_uid = (uid_t)strtol(s, &ts, 10); in passwd_read_snapshot_func()
187 pwd->pw_gid = (gid_t)strtol(s, &ts, 10); in passwd_read_snapshot_func()
192 pwd->pw_change = (time_t)strtol(s, &ts, 10); in passwd_read_snapshot_func()
197 pwd->pw_class = strdup(s); in passwd_read_snapshot_func()
198 ATF_REQUIRE(pwd->pw_class != NULL); in passwd_read_snapshot_func()
201 pwd->pw_gecos = strdup(s); in passwd_read_snapshot_func()
202 ATF_REQUIRE(pwd->pw_gecos != NULL); in passwd_read_snapshot_func()
205 pwd->pw_dir = strdup(s); in passwd_read_snapshot_func()
206 ATF_REQUIRE(pwd->pw_dir != NULL); in passwd_read_snapshot_func()
209 pwd->pw_shell = strdup(s); in passwd_read_snapshot_func()
210 ATF_REQUIRE(pwd->pw_shell != NULL); in passwd_read_snapshot_func()
213 pwd->pw_expire = (time_t)strtol(s, &ts, 10); in passwd_read_snapshot_func()
218 pwd->pw_fields = (int)strtol(s, &ts, 10); in passwd_read_snapshot_func()
230 free_passwd(pwd); in passwd_read_snapshot_func()
231 memset(pwd, 0, sizeof(struct passwd)); in passwd_read_snapshot_func()
242 struct passwd *pwd; in passwd_fill_test_data() local
247 while ((pwd = getpwent()) != NULL) { in passwd_fill_test_data()
248 if (passwd_test_correctness(pwd, NULL) == 0) { in passwd_fill_test_data()
249 TEST_DATA_APPEND(passwd, td, pwd); in passwd_fill_test_data()
250 if (cb != NULL && cb(pwd, td) != 0) in passwd_fill_test_data()
264 passwd_test_correctness(struct passwd *pwd, void *mdata __unused) in passwd_test_correctness() argument
269 dump_passwd(pwd); in passwd_test_correctness()
272 if (pwd == NULL) in passwd_test_correctness()
275 if (pwd->pw_name == NULL) in passwd_test_correctness()
278 if (pwd->pw_passwd == NULL) in passwd_test_correctness()
281 if (pwd->pw_class == NULL) in passwd_test_correctness()
284 if (pwd->pw_gecos == NULL) in passwd_test_correctness()
287 if (pwd->pw_dir == NULL) in passwd_test_correctness()
290 if (pwd->pw_shell == NULL) in passwd_test_correctness()
310 passwd_check_ambiguity(struct passwd_test_data *td, struct passwd *pwd) in passwd_check_ambiguity() argument
313 return (TEST_DATA_FIND(passwd, td, pwd, compare_passwd, NULL) != in passwd_check_ambiguity()
320 struct passwd *pwd; in passwd_test_getpwnam() local
327 pwd = getpwnam(pwd_model->pw_name); in passwd_test_getpwnam()
328 if (passwd_test_correctness(pwd, NULL) != 0) in passwd_test_getpwnam()
331 if (compare_passwd(pwd, pwd_model, NULL) != 0 && in passwd_test_getpwnam()
332 passwd_check_ambiguity((struct passwd_test_data *)mdata, pwd) != 0) in passwd_test_getpwnam()
350 struct passwd *pwd; in passwd_test_getpwuid() local
357 pwd = getpwuid(pwd_model->pw_uid); in passwd_test_getpwuid()
358 if (passwd_test_correctness(pwd, NULL) != 0 || in passwd_test_getpwuid()
359 (compare_passwd(pwd, pwd_model, NULL) != 0 && in passwd_test_getpwuid()
361 pwd) != 0)) { in passwd_test_getpwuid()
375 passwd_test_getpwent(struct passwd *pwd, void *mdata __unused) in passwd_test_getpwent() argument
381 return (passwd_test_correctness(pwd, NULL)); in passwd_test_getpwent()