Lines Matching defs:name

19  * 3. Neither the name of the University nor the names of its contributors
56 static UIDC **uidtb = NULL; /* uid to name cache */
57 static GIDC **gidtb = NULL; /* gid to name cache */
58 static UIDC **usrtb = NULL; /* user name to uid cache */
59 static GIDC **grptb = NULL; /* group name to gid cache */
127 paxwarn(1, "Unable to allocate memory for user name cache table");
151 paxwarn(1,"Unable to allocate memory for group name cache table");
159 * caches the name (if any) for the uid. If frc set, we always return the
160 * the stored name (if valid or invalid match). We use a simple hash table.
162 * Pointer to stored name (or an empty string).
183 return(ptr->name);
206 (void)snprintf(ptr->name, sizeof(ptr->name), "%lu",
217 (void)strncpy(ptr->name, pw->pw_name, UNMLEN - 1);
218 ptr->name[UNMLEN-1] = '\0';
221 return(ptr->name);
226 * caches the name (if any) for the gid. If frc set, we always return the
227 * the stored name (if valid or invalid match). We use a simple hash table.
229 * Pointer to stored name (or an empty string).
250 return(ptr->name);
273 (void)snprintf(ptr->name, sizeof(ptr->name), "%lu",
284 (void)strncpy(ptr->name, gr->gr_name, GNMLEN - 1);
285 ptr->name[GNMLEN-1] = '\0';
288 return(ptr->name);
293 * caches the uid for a given user name. We use a simple hash table.
295 * the uid (if any) for a user name, or a -1 if no match can be found
299 uid_name(char *name, uid_t *uid)
308 if (((namelen = strlen(name)) == 0) || (name[0] == '\0'))
317 ptr = usrtb[st_hash(name, namelen, UNM_SZ)];
318 if ((ptr != NULL) && (ptr->valid > 0) && !strcmp(name, ptr->name)) {
331 ptr = usrtb[st_hash(name, namelen, UNM_SZ)] =
339 if ((pw = getpwnam(name)) == NULL)
344 (void)strncpy(ptr->name, name, UNMLEN - 1);
345 ptr->name[UNMLEN-1] = '\0';
346 if ((pw = getpwnam(name)) == NULL) {
357 * caches the gid for a given group name. We use a simple hash table.
359 * the gid (if any) for a group name, or a -1 if no match can be found
363 gid_name(char *name, gid_t *gid)
372 if (((namelen = strlen(name)) == 0) || (name[0] == '\0'))
381 ptr = grptb[st_hash(name, namelen, GID_SZ)];
382 if ((ptr != NULL) && (ptr->valid > 0) && !strcmp(name, ptr->name)) {
394 ptr = grptb[st_hash(name, namelen, GID_SZ)] =
402 if ((gr = getgrnam(name)) == NULL)
408 (void)strncpy(ptr->name, name, GNMLEN - 1);
409 ptr->name[GNMLEN-1] = '\0';
410 if ((gr = getgrnam(name)) == NULL) {