Lines Matching +full:- +full:- +full:valid +full:- +full:-
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
65 * 0 if ok, -1 otherwise
76 return(-1); in uidtb_start()
80 return(-1); in uidtb_start()
89 * 0 if ok, -1 otherwise
100 return(-1); in gidtb_start()
104 return(-1); in gidtb_start()
113 * 0 if ok, -1 otherwise
124 return(-1); in usrtb_start()
128 return(-1); in usrtb_start()
137 * 0 if ok, -1 otherwise
148 return(-1); in grptb_start()
152 return(-1); in grptb_start()
160 * the stored name (if valid or invalid match). We use a simple hash table.
178 if ((ptr != NULL) && (ptr->valid > 0) && (ptr->uid == uid)) { in name_uid()
182 if (frc || (ptr->valid == VALID)) in name_uid()
183 return(ptr->name); in name_uid()
204 ptr->uid = uid; in name_uid()
205 ptr->valid = INVALID; in name_uid()
206 (void)snprintf(ptr->name, sizeof(ptr->name), "%lu", in name_uid()
215 return(pw->pw_name); in name_uid()
216 ptr->uid = uid; in name_uid()
217 (void)strncpy(ptr->name, pw->pw_name, UNMLEN - 1); in name_uid()
218 ptr->name[UNMLEN-1] = '\0'; in name_uid()
219 ptr->valid = VALID; in name_uid()
221 return(ptr->name); in name_uid()
227 * the stored name (if valid or invalid match). We use a simple hash table.
245 if ((ptr != NULL) && (ptr->valid > 0) && (ptr->gid == gid)) { in name_gid()
249 if (frc || (ptr->valid == VALID)) in name_gid()
250 return(ptr->name); in name_gid()
271 ptr->gid = gid; in name_gid()
272 ptr->valid = INVALID; in name_gid()
273 (void)snprintf(ptr->name, sizeof(ptr->name), "%lu", in name_gid()
282 return(gr->gr_name); in name_gid()
283 ptr->gid = gid; in name_gid()
284 (void)strncpy(ptr->name, gr->gr_name, GNMLEN - 1); in name_gid()
285 ptr->name[GNMLEN-1] = '\0'; in name_gid()
286 ptr->valid = VALID; in name_gid()
288 return(ptr->name); in name_gid()
295 * the uid (if any) for a user name, or a -1 if no match can be found
306 * return -1 for mangled names in uid_name()
309 return(-1); in uid_name()
311 return(-1); in uid_name()
314 * look up in hash table, if found and valid return the uid, in uid_name()
315 * if found and invalid, return a -1 in uid_name()
318 if ((ptr != NULL) && (ptr->valid > 0) && !strcmp(name, ptr->name)) { in uid_name()
319 if (ptr->valid == INVALID) in uid_name()
320 return(-1); in uid_name()
321 *uid = ptr->uid; in uid_name()
340 return(-1); in uid_name()
341 *uid = pw->pw_uid; in uid_name()
344 (void)strncpy(ptr->name, name, UNMLEN - 1); in uid_name()
345 ptr->name[UNMLEN-1] = '\0'; in uid_name()
347 ptr->valid = INVALID; in uid_name()
348 return(-1); in uid_name()
350 ptr->valid = VALID; in uid_name()
351 *uid = ptr->uid = pw->pw_uid; in uid_name()
359 * the gid (if any) for a group name, or a -1 if no match can be found
370 * return -1 for mangled names in gid_name()
373 return(-1); in gid_name()
375 return(-1); in gid_name()
378 * look up in hash table, if found and valid return the uid, in gid_name()
379 * if found and invalid, return a -1 in gid_name()
382 if ((ptr != NULL) && (ptr->valid > 0) && !strcmp(name, ptr->name)) { in gid_name()
383 if (ptr->valid == INVALID) in gid_name()
384 return(-1); in gid_name()
385 *gid = ptr->gid; in gid_name()
403 return(-1); in gid_name()
404 *gid = gr->gr_gid; in gid_name()
408 (void)strncpy(ptr->name, name, GNMLEN - 1); in gid_name()
409 ptr->name[GNMLEN-1] = '\0'; in gid_name()
411 ptr->valid = INVALID; in gid_name()
412 return(-1); in gid_name()
414 ptr->valid = VALID; in gid_name()
415 *gid = ptr->gid = gr->gr_gid; in gid_name()