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 | |
parent | 3a632674508a4c934c75e4f6052ed37f1bba07bc (diff) | |
download | glibc-8588312396635a2c5f13bd235217597456e0e4d2.tar.gz glibc-8588312396635a2c5f13bd235217597456e0e4d2.tar.xz glibc-8588312396635a2c5f13bd235217597456e0e4d2.zip |
[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>.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | nis/nss_compat/compat-initgroups.c | 17 |
2 files changed, 19 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog index 33cfca34ae..84769fb6c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-11-22 Ulrich Drepper <drepper@redhat.com> + [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>. + * locale/programs/ld-collate.c (collate_read): Fix loop to match macro name. 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); |