diff options
author | Ulrich Drepper <drepper@redhat.com> | 2007-11-23 02:36:37 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2007-11-23 02:36:37 +0000 |
commit | 8588312396635a2c5f13bd235217597456e0e4d2 (patch) | |
tree | c171a33ab586c95c6414ddd4d2fe891ffc926bf0 /nis/nss_compat | |
parent | 3a632674508a4c934c75e4f6052ed37f1bba07bc (diff) | |
download | glibc-8588312396635a2c5f13bd235217597456e0e4d2.tar.gz |
[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/nss_compat')
-rw-r--r-- | nis/nss_compat/compat-initgroups.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c index fd16475ea9..76ca95d1e6 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); |