aboutsummaryrefslogtreecommitdiff
path: root/nis
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-11-23 02:36:37 +0000
committerUlrich Drepper <drepper@redhat.com>2007-11-23 02:36:37 +0000
commit8588312396635a2c5f13bd235217597456e0e4d2 (patch)
treec171a33ab586c95c6414ddd4d2fe891ffc926bf0 /nis
parent3a632674508a4c934c75e4f6052ed37f1bba07bc (diff)
downloadglibc-8588312396635a2c5f13bd235217597456e0e4d2.zip
glibc-8588312396635a2c5f13bd235217597456e0e4d2.tar.gz
glibc-8588312396635a2c5f13bd235217597456e0e4d2.tar.bz2
[BZ #5378]
* nis/nss_compat/compat-initgroups.c (getgrent_next_nss): Don't use result of nss_getgrgid_r if nothing was found. For other error return with a failure. Partially based on a patch by Petr Baudis <pasky@suse.cz>.
Diffstat (limited to 'nis')
-rw-r--r--nis/nss_compat/compat-initgroups.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index fd16475..76ca95d 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -303,10 +303,19 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
else
tmpbuf = extend_alloca (tmpbuf, tmplen, 2 * tmplen);
- if (!in_blacklist (grpbuf.gr_name,
- strlen (grpbuf.gr_name), ent))
- check_and_add_group (user, group, start, size, groupsp,
- limit, &grpbuf);
+ if (__builtin_expect (status != NSS_STATUS_NOTFOUND, 1))
+ {
+ if (__builtin_expect (status != NSS_STATUS_SUCCESS, 0))
+ {
+ free (mygroups);
+ return status;
+ }
+
+ if (!in_blacklist (grpbuf.gr_name,
+ strlen (grpbuf.gr_name), ent))
+ check_and_add_group (user, group, start, size, groupsp,
+ limit, &grpbuf);
+ }
}
free (mygroups);