aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/request_key.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-11-13 18:39:16 -0500
committerJames Morris <jmorris@namei.org>2008-11-13 18:39:16 -0500
commitb6dff3ec5e116e3af6f537d4caedcad6b9e5082a (patch)
tree9e76f972eb7ce9b84e0146c8e4126a3f86acb428 /security/keys/request_key.c
parent15a2460ed0af7538ca8e6c610fe607a2cd9da142 (diff)
CRED: Separate task security context from task_struct
Separate the task security context from task_struct. At this point, the security data is temporarily embedded in the task_struct with two pointers pointing to it. Note that the Alpha arch is altered as it refers to (E)UID and (E)GID in entry.S via asm-offsets. With comment fixes Signed-off-by: Marc Dionne <marc.c.dionne@gmail.com> Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: James Morris <jmorris@namei.org> Acked-by: Serge Hallyn <serue@us.ibm.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/keys/request_key.c')
-rw-r--r--security/keys/request_key.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 8e9d93b4a402..3e9b9eb1dd28 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -104,7 +104,8 @@ static int call_sbin_request_key(struct key_construction *cons,
104 104
105 /* we specify the process's default keyrings */ 105 /* we specify the process's default keyrings */
106 sprintf(keyring_str[0], "%d", 106 sprintf(keyring_str[0], "%d",
107 tsk->thread_keyring ? tsk->thread_keyring->serial : 0); 107 tsk->cred->thread_keyring ?
108 tsk->cred->thread_keyring->serial : 0);
108 109
109 prkey = 0; 110 prkey = 0;
110 if (tsk->signal->process_keyring) 111 if (tsk->signal->process_keyring)
@@ -117,7 +118,7 @@ static int call_sbin_request_key(struct key_construction *cons,
117 sskey = rcu_dereference(tsk->signal->session_keyring)->serial; 118 sskey = rcu_dereference(tsk->signal->session_keyring)->serial;
118 rcu_read_unlock(); 119 rcu_read_unlock();
119 } else { 120 } else {
120 sskey = tsk->user->session_keyring->serial; 121 sskey = tsk->cred->user->session_keyring->serial;
121 } 122 }
122 123
123 sprintf(keyring_str[2], "%d", sskey); 124 sprintf(keyring_str[2], "%d", sskey);
@@ -232,11 +233,11 @@ static void construct_get_dest_keyring(struct key **_dest_keyring)
232 } else { 233 } else {
233 /* use a default keyring; falling through the cases until we 234 /* use a default keyring; falling through the cases until we
234 * find one that we actually have */ 235 * find one that we actually have */
235 switch (tsk->jit_keyring) { 236 switch (tsk->cred->jit_keyring) {
236 case KEY_REQKEY_DEFL_DEFAULT: 237 case KEY_REQKEY_DEFL_DEFAULT:
237 case KEY_REQKEY_DEFL_REQUESTOR_KEYRING: 238 case KEY_REQKEY_DEFL_REQUESTOR_KEYRING:
238 if (tsk->request_key_auth) { 239 if (tsk->cred->request_key_auth) {
239 authkey = tsk->request_key_auth; 240 authkey = tsk->cred->request_key_auth;
240 down_read(&authkey->sem); 241 down_read(&authkey->sem);
241 rka = authkey->payload.data; 242 rka = authkey->payload.data;
242 if (!test_bit(KEY_FLAG_REVOKED, 243 if (!test_bit(KEY_FLAG_REVOKED,
@@ -249,7 +250,7 @@ static void construct_get_dest_keyring(struct key **_dest_keyring)
249 } 250 }
250 251
251 case KEY_REQKEY_DEFL_THREAD_KEYRING: 252 case KEY_REQKEY_DEFL_THREAD_KEYRING:
252 dest_keyring = key_get(tsk->thread_keyring); 253 dest_keyring = key_get(tsk->cred->thread_keyring);
253 if (dest_keyring) 254 if (dest_keyring)
254 break; 255 break;
255 256
@@ -268,11 +269,12 @@ static void construct_get_dest_keyring(struct key **_dest_keyring)
268 break; 269 break;
269 270
270 case KEY_REQKEY_DEFL_USER_SESSION_KEYRING: 271 case KEY_REQKEY_DEFL_USER_SESSION_KEYRING:
271 dest_keyring = key_get(tsk->user->session_keyring); 272 dest_keyring =
273 key_get(tsk->cred->user->session_keyring);
272 break; 274 break;
273 275
274 case KEY_REQKEY_DEFL_USER_KEYRING: 276 case KEY_REQKEY_DEFL_USER_KEYRING:
275 dest_keyring = key_get(tsk->user->uid_keyring); 277 dest_keyring = key_get(tsk->cred->user->uid_keyring);
276 break; 278 break;
277 279
278 case KEY_REQKEY_DEFL_GROUP_KEYRING: 280 case KEY_REQKEY_DEFL_GROUP_KEYRING: