i noticed ukey_add is not actually adding the user to the group.
it just sets the group name as the default group for the user.
this went unnoticed for a while.

sp_priv_group_del should iterate through all the users and check if any
user belongs to the group being deleted.

Index: xcpufs/xauth.c
===================================================================
--- xcpufs/xauth.c      (revision 723)
+++ xcpufs/xauth.c      (working copy)
@@ -79,6 +79,7 @@
                        return -1;
                }
 
+               sp_priv_group_adduser(dgrp, user);
                sp_priv_user_setdfltgroup(user, dgrp);
        }
 
Index: libspfs/pvusers.c
===================================================================
--- libspfs/pvusers.c   (revision 723)
+++ libspfs/pvusers.c   (working copy)
@@ -197,6 +197,7 @@
 void
 sp_priv_group_del(Spgroup *g)
 {
+       int i;
        Spgroup *tg, *pg;
        Spuser *tu;    
        Upool *upp;
@@ -213,8 +214,13 @@
        for(tu = upp->users; tu != NULL; tu = tu->next) {
                if(!strcmp("xcpu-admin", tu->uname))
                        continue;
-               sp_werror("%s:%s", EIO, g->gname, Egroupbusy);
-               return;
+
+               for(i = 0; i < tu->ngroups; i++) {
+                       if (tu->groups[i] == g) {
+                               sp_werror("%s:%s", EIO, g->gname,
Egroupbusy);
+                               return;
+                       }
+               }
        }
 
        if (!pg)

-- 
Signed-off-by: Abhishek Kulkarni <[EMAIL PROTECTED]>

Reply via email to