diff options
author | DJ Delorie <dj@redhat.com> | 2020-11-09 22:09:34 -0500 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2020-12-04 17:16:32 -0500 |
commit | f4f3b09111e9fa38fd485979a3e40b6cfa6a757d (patch) | |
tree | f2743a776f31b86ebebc9f145dd1305bade66eef /grp/initgroups.c | |
parent | 6eceded941bb6dcc097291757e2aef5cd7212133 (diff) | |
download | glibc-f4f3b09111e9fa38fd485979a3e40b6cfa6a757d.tar.gz glibc-f4f3b09111e9fa38fd485979a3e40b6cfa6a757d.tar.xz glibc-f4f3b09111e9fa38fd485979a3e40b6cfa6a757d.zip |
nsswitch: use new internal API (callers)
Stitch new ABI and types throughout all NSS callers. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'grp/initgroups.c')
-rw-r--r-- | grp/initgroups.c | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/grp/initgroups.c b/grp/initgroups.c index 0c17141117..a60ca1c395 100644 --- a/grp/initgroups.c +++ b/grp/initgroups.c @@ -63,7 +63,6 @@ internal_getgrouplist (const char *user, gid_t group, long int *size, #endif enum nss_status status = NSS_STATUS_UNAVAIL; - int no_more = 0; /* Never store more than the starting *SIZE number of elements. */ assert (*size > 0); @@ -71,28 +70,23 @@ internal_getgrouplist (const char *user, gid_t group, long int *size, /* Start is one, because we have the first group as parameter. */ long int start = 1; - if (__nss_initgroups_database == NULL) - { - if (__nss_database_lookup2 ("initgroups", NULL, "", - &__nss_initgroups_database) < 0) - { - if (__nss_group_database == NULL) - no_more = __nss_database_lookup2 ("group", NULL, "files", - &__nss_group_database); + nss_action_list nip; - __nss_initgroups_database = __nss_group_database; - } - else - use_initgroups_entry = true; + if (__nss_database_get (nss_database_initgroups, &nip)) + { + use_initgroups_entry = true; + } + else if (__nss_database_get (nss_database_group, &nip)) + { + use_initgroups_entry = false; } else - /* __nss_initgroups_database might have been set through - __nss_configure_lookup in which case use_initgroups_entry was - not set here. */ - use_initgroups_entry = __nss_initgroups_database != __nss_group_database; + { + nip = __nss_action_parse ("files"); + use_initgroups_entry = false; + } - service_user *nip = __nss_initgroups_database; - while (! no_more) + while (nip && nip->module) { long int prev_start = start; @@ -134,10 +128,7 @@ internal_getgrouplist (const char *user, gid_t group, long int *size, && nss_next_action (nip, status) == NSS_ACTION_RETURN) break; - if (nip->next == NULL) - no_more = -1; - else - nip = nip->next; + nip++; } return start; |