Lines Matching refs:name

17  * 4. Neither the name of the University nor the names of its contributors
63 static UIDC **uidtb = NULL; /* uid to name cache */
64 static GIDC **gidtb = NULL; /* gid to name cache */
65 static UIDC **usrtb = NULL; /* user name to uid cache */
66 static GIDC **grptb = NULL; /* group name to gid cache */
134 paxwarn(1, "Unable to allocate memory for user name cache table");
158 paxwarn(1,"Unable to allocate memory for group name cache table");
166 * caches the name (if any) for the uid. If frc set, we always return the
167 * the stored name (if valid or invalid match). We use a simple hash table.
169 * Pointer to stored name (or an empty string).
190 return(ptr->name);
214 (void)snprintf(ptr->name, sizeof(ptr->name), "%u", uid);
216 (void)snprintf(ptr->name, sizeof(ptr->name), "%lu",
228 (void)strncpy(ptr->name, pw->pw_name, UNMLEN - 1);
229 ptr->name[UNMLEN-1] = '\0';
232 return(ptr->name);
237 * caches the name (if any) for the gid. If frc set, we always return the
238 * the stored name (if valid or invalid match). We use a simple hash table.
240 * Pointer to stored name (or an empty string).
261 return(ptr->name);
285 (void)snprintf(ptr->name, sizeof(ptr->name), "%u", gid);
287 (void)snprintf(ptr->name, sizeof(ptr->name), "%lu",
299 (void)strncpy(ptr->name, gr->gr_name, GNMLEN - 1);
300 ptr->name[GNMLEN-1] = '\0';
303 return(ptr->name);
308 * caches the uid for a given user name. We use a simple hash table.
310 * the uid (if any) for a user name, or a -1 if no match can be found
314 uid_name(char *name, uid_t *uid)
323 if (((namelen = strlen(name)) == 0) || (name[0] == '\0'))
332 ptr = usrtb[st_hash(name, namelen, UNM_SZ)];
333 if ((ptr != NULL) && (ptr->valid > 0) && !strcmp(name, ptr->name)) {
346 ptr = usrtb[st_hash(name, namelen, UNM_SZ)] =
354 if ((pw = getpwnam(name)) == NULL)
359 (void)strncpy(ptr->name, name, UNMLEN - 1);
360 ptr->name[UNMLEN-1] = '\0';
361 if ((pw = getpwnam(name)) == NULL) {
372 * caches the gid for a given group name. We use a simple hash table.
374 * the gid (if any) for a group name, or a -1 if no match can be found
378 gid_name(char *name, gid_t *gid)
387 if (((namelen = strlen(name)) == 0) || (name[0] == '\0'))
396 ptr = grptb[st_hash(name, namelen, GID_SZ)];
397 if ((ptr != NULL) && (ptr->valid > 0) && !strcmp(name, ptr->name)) {
409 ptr = grptb[st_hash(name, namelen, GID_SZ)] =
417 if ((gr = getgrnam(name)) == NULL)
423 (void)strncpy(ptr->name, name, GNMLEN - 1);
424 ptr->name[GNMLEN-1] = '\0';
425 if ((gr = getgrnam(name)) == NULL) {