Commit 7ab501db authored by David Howells's avatar David Howells Committed by Linus Torvalds

[PATCH] Keys: Possessor permissions should be additive

This patch makes the possessor permissions on a key additive with
user/group/other permissions on the same key.

This permits extra rights to be granted to the possessor of a key without
taking away any rights conferred by them owning the key or having common group
membership.
Signed-Off-By: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 468ed2b0
...@@ -27,12 +27,6 @@ int key_task_permission(const key_ref_t key_ref, ...@@ -27,12 +27,6 @@ int key_task_permission(const key_ref_t key_ref,
key = key_ref_to_ptr(key_ref); key = key_ref_to_ptr(key_ref);
/* use the top 8-bits of permissions for keys the caller possesses */
if (is_key_possessed(key_ref)) {
kperm = key->perm >> 24;
goto use_these_perms;
}
/* use the second 8-bits of permissions for keys the caller owns */ /* use the second 8-bits of permissions for keys the caller owns */
if (key->uid == context->fsuid) { if (key->uid == context->fsuid) {
kperm = key->perm >> 16; kperm = key->perm >> 16;
...@@ -61,6 +55,12 @@ int key_task_permission(const key_ref_t key_ref, ...@@ -61,6 +55,12 @@ int key_task_permission(const key_ref_t key_ref,
kperm = key->perm; kperm = key->perm;
use_these_perms: use_these_perms:
/* use the top 8-bits of permissions for keys the caller possesses
* - possessor permissions are additive with other permissions
*/
if (is_key_possessed(key_ref))
kperm |= key->perm >> 24;
kperm = kperm & perm & KEY_ALL; kperm = kperm & perm & KEY_ALL;
return kperm == perm; return kperm == perm;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment