[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#698102: initgroups changes egid on kfreebsd



Hi Michael,

please would you mind to try patch bellow ?

The function internal_getgrouplist() in grp/initgroups.c puts supplied "group" as the first entry in all but NSCD cases.

Please could you test whether it fixes the problem in your environment.

--- nscd/nscd_initgroups.c
+++ nscd/nscd_initgroups.c
@@ -144,15 +144,23 @@
     }

   /* Check whether GROUP is part of the mix.  If not, add it.  */
+  /* The GROUP have to be in the first entry */
   if (retval >= 0)
     {
       int cnt;
+      gid_t sg, tg;
+      sg = group;
       for (cnt = 0; cnt < retval; ++cnt)
-       if ((*groupsp)[cnt] == group)
-         break;
+      {
+        tg = (*groupsp)[cnt];
+        (*groupsp)[cnt] = sg;
+        if (tg == group)
+          break;
+        sg = tg;
+      }

       if (cnt == retval)
-       (*groupsp)[retval++] = group;
+       (*groupsp)[retval++] = sg;
     }

  out_close:


Reply to: