public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Link user keyrings together correctly
Date: Thu, 23 Sep 2004 10:48:38 +0100	[thread overview]
Message-ID: <26022.1095932918@redhat.com> (raw)


The attached patch causes the per-user keyring to be linked into the user's
default session keyring rather than the other way around.

Signed-Off-By: David Howells <dhowells@redhat.com>
---

 process_keys.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff -uNrp linux-2.6.9-rc2-mm1/security/keys/process_keys.c linux-2.6.9-rc2-mm1-afskey/security/keys/process_keys.c
--- linux-2.6.9-rc2-mm1/security/keys/process_keys.c	2004-09-16 12:09:57.000000000 +0100
+++ linux-2.6.9-rc2-mm1-afskey/security/keys/process_keys.c	2004-09-22 14:25:20.000000000 +0100
@@ -74,24 +74,24 @@ int alloc_uid_keyring(struct user_struct
 	char buf[20];
 	int ret;
 
-	/* concoct a UID specific keyring */
-	sprintf(buf, "_uid.%u", user->uid);
+	/* concoct a default session keyring */
+	sprintf(buf, "_uid_ses.%u", user->uid);
 
-	uid_keyring = keyring_alloc(buf, user->uid, (gid_t) -1, 0, NULL);
-	if (IS_ERR(uid_keyring)) {
-		ret = PTR_ERR(uid_keyring);
+	session_keyring = keyring_alloc(buf, user->uid, (gid_t) -1, 0, NULL);
+	if (IS_ERR(session_keyring)) {
+		ret = PTR_ERR(session_keyring);
 		goto error;
 	}
 
-	/* and a default session keyring with a pointer to the UID specific
+	/* and a UID specific keyring, pointed to by the default session
 	 * keyring */
-	sprintf(buf, "_uid_ses.%u", user->uid);
+	sprintf(buf, "_uid.%u", user->uid);
 
-	session_keyring = keyring_alloc(buf, user->uid, (gid_t) -1, 0,
-					uid_keyring);
-	if (IS_ERR(session_keyring)) {
-		key_put(uid_keyring);
-		ret = PTR_ERR(session_keyring);
+	uid_keyring = keyring_alloc(buf, user->uid, (gid_t) -1, 0,
+				    session_keyring);
+	if (IS_ERR(uid_keyring)) {
+		key_put(session_keyring);
+		ret = PTR_ERR(uid_keyring);
 		goto error;
 	}
 

                 reply	other threads:[~2004-09-23  9:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=26022.1095932918@redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.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