Fixed minor issues on capability list sharing.

This commit is contained in:
Bahadir Balban
2009-12-13 18:02:47 +02:00
parent 8fe15ba811
commit c7069a8e8e
9 changed files with 86 additions and 22 deletions

View File

@@ -69,24 +69,43 @@ int cap_share_single(struct capability *user)
return 0;
}
#if 0
/* Shares the whole list */
int cap_share_all(void)
/*
* Shares the whole capability list.
*
* FIXME: Make sure each and every capability has its
* share right set!
*/
int cap_share_all(unsigned int flags)
{
cap_list_move(&curcont->cap_list,
&current->space->cap_list);
if (flags == CAP_SHARE_ALL_CONTAINER) {
/* Move all private caps to container */
cap_list_move(&curcont->cap_list,
&current->cap_list);
/*
* Move all space caps to container, also.
*
* FIXME: Make sure all space capabilities
* are owned by the sharer!!!
*/
cap_list_move(&curcont->cap_list,
&current->space->cap_list);
} else if (flags == CAP_SHARE_ALL_SPACE) {
/* Move all private caps to space */
cap_list_move(&current->space->cap_list,
&current->cap_list);
}
return 0;
}
#endif
int cap_share(struct capability *cap, unsigned int flags)
{
if (flags & CAP_SHARE_SINGLE)
cap_share_single(cap);
if (flags == CAP_SHARE_SINGLE)
return cap_share_single(cap);
else
return -EINVAL;
return 0;
return cap_share_all(flags);
}
#if 0
@@ -665,6 +684,9 @@ int sys_capability_control(unsigned int req, unsigned int flags, void *userbuf)
return err;
break;
case CAP_CONTROL_SHARE:
if (flags == CAP_SHARE_ALL_CONTAINER ||
flags == CAP_SHARE_ALL_SPACE)
break;
case CAP_CONTROL_GRANT:
case CAP_CONTROL_SPLIT:
case CAP_CONTROL_REPLICATE: