GNU C Library master sources branch, master, updated. glibc-2.12-220-geaca756

drepper@sourceware.org drepper@sourceware.org
Mon Nov 22 16:16:00 GMT 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  eaca75697fdc5c21195935eca2f0b149a75c0316 (commit)
       via  3056dcdb783a177158a5617657d1a33f872358d6 (commit)
      from  cf7c9078a5acdbb435498ace92cd81009637a971 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=eaca75697fdc5c21195935eca2f0b149a75c0316

commit eaca75697fdc5c21195935eca2f0b149a75c0316
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Mon Nov 22 11:15:08 2010 -0500

    Optimize last initgroups patch a bit.

diff --git a/ChangeLog b/ChangeLog
index 66bc545..daf74dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-22  Ulrich Drepper  <drepper@gmail.com>
+
+	* nis/nss_compat/compat-initgroups.c (internal_getgrent_r): Optimize
+	last patch a bit.  Pretty printing
+
 2010-05-31  Petr Baudis <pasky@suse.cz>
 
 	[BZ #10085]
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index de8d95c..caff38f 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2004, 2006, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2004,2006,2007,2009,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -288,12 +288,12 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
 	return NSS_STATUS_TRYAGAIN;
 
       /* For every gid in the list we get from the NSS module,
-         get the whole group entry. We need to do this, since we
-         need the group name to check if it is in the blacklist.
-         In worst case, this is as twice as slow as stepping with
-         getgrent_r through the whole group database. But for large
-         group databases this is faster, since the user can only be
-         in a limited number of groups.  */
+	 get the whole group entry. We need to do this, since we
+	 need the group name to check if it is in the blacklist.
+	 In worst case, this is as twice as slow as stepping with
+	 getgrent_r through the whole group database. But for large
+	 group databases this is faster, since the user can only be
+	 in a limited number of groups.  */
       if (nss_initgroups_dyn (user, group, &mystart, &mysize, &mygroups,
 			      limit, errnop) == NSS_STATUS_SUCCESS)
 	{
@@ -426,7 +426,7 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
 	}
       while (*p == '\0' || *p == '#' ||	/* Ignore empty and comment lines. */
 	     /* Parse the line.  If it is invalid, loop to
-	        get the next line of the file to parse.  */
+		get the next line of the file to parse.  */
 	     !(parse_res = _nss_files_parse_grent (p, &grpbuf, data, buflen,
 						   errnop)));
 
@@ -477,15 +477,15 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
 	  if (nss_initgroups_dyn == NULL || nss_getgrgid_r == NULL)
 	    {
 	      if (nss_setgrent != NULL)
-	        {
+		{
 		  nss_setgrent (1);
 		  ent->need_endgrent = true;
 		}
 	      ent->skip_initgroups_dyn = true;
-	    }
 
-	  if (ent->skip_initgroups_dyn && nss_getgrent_r == NULL)
-	    return NSS_STATUS_UNAVAIL;
+	      if (nss_getgrent_r == NULL)
+		return NSS_STATUS_UNAVAIL;
+	    }
 
 	  ent->files = false;
 

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3056dcdb783a177158a5617657d1a33f872358d6

commit 3056dcdb783a177158a5617657d1a33f872358d6
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Mon Nov 22 11:11:24 2010 -0500

    Fix multiple nss_compat initgroups() bugs
    
    Compat initgroups() is completely broken; the code will always set
    skip_initgroups_dyn to true, so initgroups() will never be actually
    called, but due to the nature of the code, setgrent() won't be called
    either - thus, subsequent invocations of initgroups() will not return
    the NIS group list anymore.
    
    This is a simple patch that makes sure skip_initgroups_dyn is set only
    in case initgroups is not available; it also attempts to handle the
    unavailability of other NSS interfaces better.
    
    Conflicts:
    
    	ChangeLog

diff --git a/ChangeLog b/ChangeLog
index 124dd4c..66bc545 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-31  Petr Baudis <pasky@suse.cz>
+
+	[BZ #10085]
+	* nis/nss_compat/compat-initgroups.c (internal_getgrent_r): Fix
+	initialization of skip_initgroups_dyn.
+
 2010-11-19  Ulrich Drepper  <drepper@gmail.com>
 
 	* sysdeps/unix/sysv/linux/i386/bits/mman.h: Define MAP_HUGETLB.
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index 07a3b92..de8d95c 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -474,18 +474,21 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
 	  /* If the selected module does not support getgrent_r or
 	     initgroups_dyn, abort. We cannot find the needed group
 	     entries.  */
-	  if (nss_getgrent_r == NULL && nss_initgroups_dyn == NULL)
+	  if (nss_initgroups_dyn == NULL || nss_getgrgid_r == NULL)
+	    {
+	      if (nss_setgrent != NULL)
+	        {
+		  nss_setgrent (1);
+		  ent->need_endgrent = true;
+		}
+	      ent->skip_initgroups_dyn = true;
+	    }
+
+	  if (ent->skip_initgroups_dyn && nss_getgrent_r == NULL)
 	    return NSS_STATUS_UNAVAIL;
 
 	  ent->files = false;
 
-	  if (nss_initgroups_dyn == NULL && nss_setgrent != NULL)
-	    {
-	      nss_setgrent (1);
-	      ent->need_endgrent = true;
-	    }
-	  ent->skip_initgroups_dyn = true;
-
 	  return getgrent_next_nss (ent, buffer, buflen, user, group,
 				    start, size, groupsp, limit, errnop);
 	}

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                          |   11 ++++++++++
 nis/nss_compat/compat-initgroups.c |   37 +++++++++++++++++++----------------
 2 files changed, 31 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources



More information about the Glibc-cvs mailing list