From: Ulrich Drepper Date: Fri, 23 Nov 2007 02:36:37 +0000 (+0000) Subject: [BZ #5378] X-Git-Tag: cvs/fedora-glibc-20071212T1051~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8588312396635a2c5f13bd235217597456e0e4d2;p=platform%2Fupstream%2Fglibc.git [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 . --- diff --git a/ChangeLog b/ChangeLog index 33cfca3..84769fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-11-22 Ulrich Drepper + [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 . + * 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 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);