glibc/glibc-nis-initgroups.diff

40 lines
1.3 KiB
Diff
Raw Normal View History

2010-05-31 Petr Baudis <pasky@suse.cz>
* nis/nss_compat/compat-initgroups.c (internal_getgrent_r): Fix
initialization of skip_initgroups_dyn.
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index 07a3b92..de8d95c 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -474,18 +474,21 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
/* If the selected module does not support getgrent_r or
initgroups_dyn, abort. We cannot find the needed group
entries. */
- if (nss_getgrent_r == NULL && nss_initgroups_dyn == NULL)
+ if (nss_initgroups_dyn == NULL || nss_getgrgid_r == NULL)
+ {
+ if (nss_setgrent != NULL)
+ {
+ nss_setgrent (1);
+ ent->need_endgrent = true;
+ }
+ ent->skip_initgroups_dyn = true;
+ }
+
+ if (ent->skip_initgroups_dyn && nss_getgrent_r == NULL)
return NSS_STATUS_UNAVAIL;
ent->files = false;
- if (nss_initgroups_dyn == NULL && nss_setgrent != NULL)
- {
- nss_setgrent (1);
- ent->need_endgrent = true;
- }
- ent->skip_initgroups_dyn = true;
-
return getgrent_next_nss (ent, buffer, buflen, user, group,
start, size, groupsp, limit, errnop);
}