static int
internal_function
-__nss_group_nonlocal_lookup(service_user **ni, const char *fct_name,
- void **fctp)
+__nss_group_nonlocal_lookup2(service_user **ni, const char *fct_name,
+ const char *fct2_name, void **fctp)
{
if (__nss_group_nonlocal_database == NULL
&& __nss_database_lookup("group_nonlocal", NULL, NULL,
*ni = __nss_group_nonlocal_database;
*fctp = __nss_lookup_function(*ni, fct_name);
+ if (*fctp == NULL && fct2_name != NULL)
+ *fctp = __nss_lookup_function(*ni, fct2_name);
return 0;
}
char *buf;
size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
const struct walk_nss w = {
- .lookup = &__nss_group_lookup, .fct_name = "getgrgid_r",
+ .lookup2 = &__nss_group_lookup2, .fct_name = "getgrgid_r",
.status = &status, .errnop = errnop, .buf = &buf, .buflen = &buflen
};
const __typeof__(&_nss_nonlocal_getgrgid_r) self = &_nss_nonlocal_getgrgid_r;
enum nss_status status;
size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
const struct walk_nss w = {
- .lookup = &__nss_group_lookup, .fct_name = "getgrnam_r",
+ .lookup2 = &__nss_group_lookup2, .fct_name = "getgrnam_r",
.status = &status, .errnop = errnop, .buf = buffer, .buflen = &buflen
};
const __typeof__(&_nss_nonlocal_getgrnam_r) self = &_nss_nonlocal_getgrnam_r;
return status;
}
+static bool grent_initialized = false;
static service_user *grent_startp, *grent_nip;
static void *grent_fct_start;
static union {
{
enum nss_status status;
const struct walk_nss w = {
- .lookup = &__nss_group_nonlocal_lookup, .fct_name = "setgrent",
+ .lookup2 = &__nss_group_nonlocal_lookup2, .fct_name = "setgrent",
.status = &status
};
const __typeof__(&_nss_nonlocal_setgrent) self = NULL;
if (status != NSS_STATUS_SUCCESS)
return status;
- if (grent_fct_start == NULL)
- __nss_group_nonlocal_lookup(&grent_startp, grent_fct_name,
- &grent_fct_start);
+ if (!grent_initialized) {
+ __nss_group_nonlocal_lookup2(&grent_startp, grent_fct_name, NULL,
+ &grent_fct_start);
+ __sync_synchronize();
+ grent_initialized = true;
+ }
grent_nip = grent_startp;
grent_fct.ptr = grent_fct_start;
return NSS_STATUS_SUCCESS;
{
enum nss_status status;
const struct walk_nss w = {
- .lookup = &__nss_group_nonlocal_lookup, .fct_name = "endgrent",
- .status = &status
+ .lookup2 = &__nss_group_nonlocal_lookup2, .fct_name = "endgrent",
+ .status = &status, .all_values = 1,
};
const __typeof__(&_nss_nonlocal_endgrent) self = NULL;
if (status == NSS_STATUS_SUCCESS)
return NSS_STATUS_SUCCESS;
- } while (__nss_next(&grent_nip, grent_fct_name, &grent_fct.ptr, status, 0) == 0);
+ } while (__nss_next2(&grent_nip, grent_fct_name, NULL, &grent_fct.ptr,
+ status, 0) == 0);
grent_nip = NULL;
return NSS_STATUS_NOTFOUND;
{
enum nss_status status;
const struct walk_nss w = {
- .lookup = &__nss_group_nonlocal_lookup, .fct_name = "getgrnam_r",
+ .lookup2 = &__nss_group_nonlocal_lookup2, .fct_name = "getgrnam_r",
.status = &status, .errnop = errnop
};
const __typeof__(&_nss_nonlocal_getgrnam_r) self = NULL;
{
enum nss_status status;
const struct walk_nss w = {
- .lookup = &__nss_group_nonlocal_lookup, .fct_name = "getgrgid_r",
+ .lookup2 = &__nss_group_nonlocal_lookup2, .fct_name = "getgrgid_r",
.status = &status, .errnop = errnop
};
const __typeof__(&_nss_nonlocal_getgrgid_r) self = NULL;
{
enum nss_status status;
const struct walk_nss w = {
- .lookup = &__nss_group_nonlocal_lookup, .fct_name = "initgroups_dyn",
- .status = &status, .errnop = errnop
+ .lookup2 = &__nss_group_nonlocal_lookup2, .fct_name = "initgroups_dyn",
+ .status = &status, .all_values = 1, .errnop = errnop
};
const __typeof__(&_nss_nonlocal_initgroups_dyn) self = NULL;
#define args (user, group, start, size, groupsp, limit, errnop)
#include "walk_nss.h"
#undef args
- if (status != NSS_STATUS_SUCCESS)
+ if (status == NSS_STATUS_NOTFOUND || status == NSS_STATUS_UNAVAIL)
+ return NSS_STATUS_SUCCESS;
+ else if (status != NSS_STATUS_SUCCESS)
return status;
for (; in < *start; ++in) {