int netname2user (const char netname[MAXNETNAMELEN + 1], uid_t * uidp, gid_t * gidp, int *gidlenp, gid_t * gidlist) { static service_user *startp; static netname2user_function start_fct; service_user *nip; union { netname2user_function f; void *ptr; } fct; enum nss_status status = NSS_STATUS_UNAVAIL; int no_more; if (startp == NULL) { no_more = __nss_publickey_lookup (&nip, "netname2user", &fct.ptr); if (no_more) startp = (service_user *) - 1; else { startp = nip; start_fct = fct.f; } } else { fct.f = start_fct; no_more = (nip = startp) == (service_user *) - 1; } while (!no_more) { status = (*fct.f) (netname, uidp, gidp, gidlenp, gidlist); no_more = __nss_next (&nip, "netname2user", &fct.ptr, status, 0); } return status == NSS_STATUS_SUCCESS; }
int getsecretkey (const char *name, char *key, const char *passwd) { static service_user *startp; static secret_function start_fct; service_user *nip; union { secret_function f; void *ptr; } fct; enum nss_status status = NSS_STATUS_UNAVAIL; int no_more; if (startp == NULL) { no_more = __nss_publickey_lookup (&nip, "getsecretkey", &fct.ptr); if (no_more) startp = (service_user *) -1; else { startp = nip; start_fct = fct.f; } } else { fct.f = start_fct; no_more = (nip = startp) == (service_user *) -1; } while (! no_more) { status = (*fct.f) (name, key, passwd, &errno); no_more = __nss_next2 (&nip, "getsecretkey", NULL, &fct.ptr, status, 0); } return status == NSS_STATUS_SUCCESS; }