about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2009-09-02 19:48:39 -0700
committerPetr Baudis <pasky@suse.cz>2009-09-18 20:04:24 +0200
commitebe5fd942feccba4e9f831baccf3778393f90d1c (patch)
tree73ac876bc92a8bac121055e49f2511308236358f
parentf771e5b84d8418ce44b88feabfeb64c248248347 (diff)
downloadglibc-ebe5fd942feccba4e9f831baccf3778393f90d1c.tar.gz
glibc-ebe5fd942feccba4e9f831baccf3778393f90d1c.tar.xz
glibc-ebe5fd942feccba4e9f831baccf3778393f90d1c.zip
Fix lookup of group names in hesiod initgroups.
Resolving names from a grplist entry actually never worked.
(cherry picked from commit 2eeb9a5d73bd86261b69e61955741e3ce86c28f6)
-rw-r--r--ChangeLog5
-rw-r--r--hesiod/nss_hesiod/hesiod-grp.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 00b782a243..4f4330241b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-01  Andreas Schwab  <schwab@redhat.com>
+
+	* hesiod/nss_hesiod/hesiod-grp.c (internal_gid_from_group): Fix
+	parsing of group entry.
+
 2009-09-02  Andreas Schwab  <schwab@redhat.com>
 
 	* libio/wfileops.c (_IO_wfile_seekoff): Account for readahead in
diff --git a/hesiod/nss_hesiod/hesiod-grp.c b/hesiod/nss_hesiod/hesiod-grp.c
index 50c53f7893..f0c8c31e06 100644
--- a/hesiod/nss_hesiod/hesiod-grp.c
+++ b/hesiod/nss_hesiod/hesiod-grp.c
@@ -139,21 +139,19 @@ internal_gid_from_group (void *context, const char *groupname, gid_t *group)
     {
       char *p = *grp_res;
 
+      /* Skip to third field.  */
       while (*p != '\0' && *p != ':')
 	++p;
-      while (*p != '\0' && *p == ':')
+      if (*p != '\0')
 	++p;
       while (*p != '\0' && *p != ':')
 	++p;
-      while (*p != '\0' && *p == ':')
-	++p;
-      if (*p == ':')
+      if (*p != '\0')
 	{
 	  char *endp;
 	  char *q = ++p;
 	  long int val;
 
-	  q = p;
 	  while (*q != '\0' && *q != ':')
 	    ++q;