summaryrefslogtreecommitdiff
path: root/libc/nis
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2010-12-06 20:43:02 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2010-12-06 20:43:02 +0000
commite7de0d4fc0526318aa0be1fcb6ec60cf27ce18c7 (patch)
tree8bccaab3a0d93c25f8c901c391970e12dea9e48c /libc/nis
parent486caa1f257e98014ac78f7f7715876f705c17dd (diff)
downloadeglibc2-e7de0d4fc0526318aa0be1fcb6ec60cf27ce18c7.tar.gz
Merge changes between r11980 and r12228 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@12229 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/nis')
-rw-r--r--libc/nis/nss_compat/compat-initgroups.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/libc/nis/nss_compat/compat-initgroups.c b/libc/nis/nss_compat/compat-initgroups.c
index 07a3b9282..caff38f9c 100644
--- a/libc/nis/nss_compat/compat-initgroups.c
+++ b/libc/nis/nss_compat/compat-initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2004, 2006, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2004,2006,2007,2009,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
@@ -288,12 +288,12 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
return NSS_STATUS_TRYAGAIN;
/* For every gid in the list we get from the NSS module,
- get the whole group entry. We need to do this, since we
- need the group name to check if it is in the blacklist.
- In worst case, this is as twice as slow as stepping with
- getgrent_r through the whole group database. But for large
- group databases this is faster, since the user can only be
- in a limited number of groups. */
+ get the whole group entry. We need to do this, since we
+ need the group name to check if it is in the blacklist.
+ In worst case, this is as twice as slow as stepping with
+ getgrent_r through the whole group database. But for large
+ group databases this is faster, since the user can only be
+ in a limited number of groups. */
if (nss_initgroups_dyn (user, group, &mystart, &mysize, &mygroups,
limit, errnop) == NSS_STATUS_SUCCESS)
{
@@ -426,7 +426,7 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
}
while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
/* Parse the line. If it is invalid, loop to
- get the next line of the file to parse. */
+ get the next line of the file to parse. */
!(parse_res = _nss_files_parse_grent (p, &grpbuf, data, buflen,
errnop)));
@@ -474,17 +474,20 @@ 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)
- return NSS_STATUS_UNAVAIL;
-
- ent->files = false;
-
- if (nss_initgroups_dyn == NULL && nss_setgrent != NULL)
+ if (nss_initgroups_dyn == NULL || nss_getgrgid_r == NULL)
{
- nss_setgrent (1);
- ent->need_endgrent = true;
+ if (nss_setgrent != NULL)
+ {
+ nss_setgrent (1);
+ ent->need_endgrent = true;
+ }
+ ent->skip_initgroups_dyn = true;
+
+ if (nss_getgrent_r == NULL)
+ return NSS_STATUS_UNAVAIL;
}
- ent->skip_initgroups_dyn = true;
+
+ ent->files = false;
return getgrent_next_nss (ent, buffer, buflen, user, group,
start, size, groupsp, limit, errnop);