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 | |
parent | 6eceded941bb6dcc097291757e2aef5cd7212133 (diff) | |
download | glibc-f4f3b09111e9fa38fd485979a3e40b6cfa6a757d.zip glibc-f4f3b09111e9fa38fd485979a3e40b6cfa6a757d.tar.gz glibc-f4f3b09111e9fa38fd485979a3e40b6cfa6a757d.tar.bz2 |
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')
-rw-r--r-- | grp/compat-initgroups.c | 2 | ||||
-rw-r--r-- | grp/initgroups.c | 37 |
2 files changed, 15 insertions, 24 deletions
diff --git a/grp/compat-initgroups.c b/grp/compat-initgroups.c index 3dd50d2..9df9407 100644 --- a/grp/compat-initgroups.c +++ b/grp/compat-initgroups.c @@ -10,7 +10,7 @@ typedef enum nss_status (*get_function) (struct group *, char *, static enum nss_status -compat_call (service_user *nip, const char *user, gid_t group, long int *start, +compat_call (nss_action_list nip, const char *user, gid_t group, long int *start, long int *size, gid_t **groupsp, long int limit, int *errnop) { struct group grpbuf; diff --git a/grp/initgroups.c b/grp/initgroups.c index 0c17141..a60ca1c 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; |