[PATCH] Keys: Fix request_key default keyring handling

David Howells
2005-04-01T15:31:32Z

The attached patch fixes the way request_key handles the default destination
key when it's the group keyring. It also removes the check for the no-change
default keyring spec, which shouldn't appear in the task_struct::jit_keyring
member (it's purely for getting the old value from the keyctl function).

Signed-Off-By: Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Signed-Off-By: David Howells <dhowells@redhat.com>
---
warthog>diffstat -p1 /tmp/keys.patch
security/keys/keyctl.c | 2 +-
security/keys/request_key.c | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)

--- ./security/keys/request_key.c.orig 2005-03-31 21:23:43.000000000 +0200
+++ ./security/keys/request_key.c 2005-03-31 21:41:03.000000000 +0200
@@ -335,8 +335,7 @@ static void request_key_link(struct key
dest_keyring = current->user->uid_keyring;
break;

- case KEY_REQKEY_DEFL_NO_CHANGE:
- case KEY_SPEC_GROUP_KEYRING:
+ case KEY_REQKEY_DEFL_GROUP_KEYRING:
default:
BUG();
}
--- ./security/keys/keyctl.c.orig 2005-03-31 21:41:35.000000000 +0200
+++ ./security/keys/keyctl.c 2005-03-31 21:42:01.000000000 +0200
@@ -951,7 +951,7 @@ long keyctl_set_reqkey_keyring(int reqke
case KEY_REQKEY_DEFL_NO_CHANGE:
return current->jit_keyring;

- case KEY_SPEC_GROUP_KEYRING:
+ case KEY_REQKEY_DEFL_GROUP_KEYRING:
default:
return -EINVAL;
}