]> sourceware.org Git - glibc.git/commitdiff
[BZ #5378]
authorUlrich Drepper <drepper@redhat.com>
Fri, 23 Nov 2007 02:36:37 +0000 (02:36 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 23 Nov 2007 02:36:37 +0000 (02:36 +0000)
* 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>.

ChangeLog
nis/nss_compat/compat-initgroups.c

index 33cfca34ae234cee55e008910ab29273983e3530..84769fb6c07d5a494d93b4fd31c81713a7eb4e36 100644 (file)
--- 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.
 
index fd16475ea9642374b08b7aa4a43ef167e213398b..76ca95d1e6e0754169f617e27abd68d48d6e1d62 100644 (file)
@@ -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);
This page took 0.047795 seconds and 5 git commands to generate.