public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: torvalds@osdl.org, akpm@osdl.org
Cc: keyrings@linux-nfs.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Keys: Possessor permissions should be additive
Date: Fri, 07 Oct 2005 16:41:24 +0100	[thread overview]
Message-ID: <19008.1128699684@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <11615.1128694058@warthog.cambridge.redhat.com>


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.

This needs to be applied on top of the patch ensubjected:

	[PATCH] Keys: Split key permissions checking into a .c file 

Signed-Off-By: David Howells <dhowells@redhat.com>
---
warthog>diffstat -p1 keys-addperm-2614rc3.diff
 security/keys/permission.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff -uNrp linux-2.6.14-rc3-keys-split/security/keys/permission.c linux-2.6.14-rc3-keys-addperm/security/keys/permission.c
--- linux-2.6.14-rc3-keys-split/security/keys/permission.c	2005-10-07 14:06:35.000000000 +0100
+++ linux-2.6.14-rc3-keys-addperm/security/keys/permission.c	2005-10-07 16:29:59.000000000 +0100
@@ -27,12 +27,6 @@ int key_task_permission(const key_ref_t 
 
 	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 */
 	if (key->uid == context->fsuid) {
 		kperm = key->perm >> 16;
@@ -61,6 +55,12 @@ int key_task_permission(const key_ref_t 
 	kperm = key->perm;
 
 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;
 
 	return kperm == perm;


  reply	other threads:[~2005-10-07 15:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-07 14:07 [PATCH] Keys: Split key permissions checking into a .c file David Howells
2005-10-07 15:41 ` David Howells [this message]
2005-10-07 15:57   ` [PATCH] Keys: Add LSM hooks for key management [try #2] David Howells
2005-10-07 16:08     ` [PATCH] Keys: Remove key duplication David Howells
2005-10-07 22:04     ` [Keyrings] [PATCH] Keys: Add LSM hooks for key management [try #2] Chris Wright
2005-10-07 23:34       ` David Howells
2005-10-07 23:35         ` Chris Wright
2005-10-07 23:38           ` David Howells
2005-10-07 23:45             ` David Howells
2005-10-07 23:46               ` Chris Wright
2005-10-07 23:46             ` Chris Wright
2005-10-08  6:51   ` [PATCH] Keys: Add LSM hooks for key management [try #3] Chris Wright
2005-11-01 14:16 ` [PATCH] Keys: Remove incorrect and obsolete '!' operators David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19008.1128699684@warthog.cambridge.redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@osdl.org \
    --cc=keyrings@linux-nfs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox