addendum to the patch:
fix ukey_del to delete the users from their respective groups.
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);
}
@@ -89,9 +90,13 @@
ukey_del(Spuserpool *up, char *uname)
{
Spuser *user;
+ int i;
user = up->uname2user(up, uname);
if (user) {
+ for(i=0; i < user->ngroups; i++)
+ sp_priv_group_deluser(user->groups[i], user);
+
sp_priv_user_del(user);
sp_user_decref(user);
return 0;
On Tue, 2008-11-04 at 17:32 -0700, Abhishek Kulkarni wrote:
> 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]>