about summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-10-05 15:36:41 +0000
committerUlrich Drepper <drepper@redhat.com>2004-10-05 15:36:41 +0000
commit695c43708f8778c09915b297c95e48d66c814d0d (patch)
treeb5593c4094f5e8b2b2e1cb075392987d00f079b1 /nscd
parent6ab5f50de41c22de3752722108def4ae721aec13 (diff)
downloadglibc-695c43708f8778c09915b297c95e48d66c814d0d.tar.gz
glibc-695c43708f8778c09915b297c95e48d66c814d0d.tar.xz
glibc-695c43708f8778c09915b297c95e48d66c814d0d.zip
Update.
2004-10-05  Ulrich Drepper  <drepper@redhat.com>

	* grp/initgroups.c: Remove duplicate group IDs.
	* grp/compat-initgroups.c: Likewise.
	* nscd/initgrcache.c: Likewise.
Diffstat (limited to 'nscd')
-rw-r--r--nscd/initgrcache.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index 124b4bae62..b46433716b 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -117,6 +117,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
   /* Nothing added yet.  */
   while (! no_more)
     {
+      long int prev_start = start;
       enum nss_status status;
       initgroups_dyn_function fct;
       fct = __nss_lookup_function (nip, "initgroups_dyn");
@@ -133,6 +134,21 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
 	status = DL_CALL_FCT (fct, (key, -1, &start, &size, &groups,
 				    limit, &errno));
 
+      /* Remove duplicates.  */
+      long int cnt = prev_start;
+      while (cnt < start)
+	{
+	  long int inner;
+	  for (inner = 0; inner < prev_start; ++inner)
+	    if (groups[inner] == groups[cnt])
+	      break;
+
+	  if (inner < prev_start)
+	    groups[cnt] = groups[--start];
+	  else
+	    ++cnt;
+	}
+
       if (status != NSS_STATUS_TRYAGAIN)
 	all_tryagain = false;