aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/request_key.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-02-08 10:53:04 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-09-13 21:28:02 -0400
commit9a56c2db49e7349c7963f0ce66c1ef578d44ebd3 (patch)
treede29b56483bb00efabca3ba35c7001cab2aab7be /security/keys/request_key.c
parent5fce5e0bbd44263c36f58ad1113b599d06ed1978 (diff)
userns: Convert security/keys to the new userns infrastructure
- Replace key_user ->user_ns equality checks with kuid_has_mapping checks. - Use from_kuid to generate key descriptions - Use kuid_t and kgid_t and the associated helpers instead of uid_t and gid_t - Avoid potential problems with file descriptor passing by displaying keys in the user namespace of the opener of key status proc files. Cc: linux-security-module@vger.kernel.org Cc: keyrings@linux-nfs.org Cc: David Howells <dhowells@redhat.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'security/keys/request_key.c')
-rw-r--r--security/keys/request_key.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 000e75017520..66e21184b559 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -139,8 +139,8 @@ static int call_sbin_request_key(struct key_construction *cons,
139 goto error_link; 139 goto error_link;
140 140
141 /* record the UID and GID */ 141 /* record the UID and GID */
142 sprintf(uid_str, "%d", cred->fsuid); 142 sprintf(uid_str, "%d", from_kuid(&init_user_ns, cred->fsuid));
143 sprintf(gid_str, "%d", cred->fsgid); 143 sprintf(gid_str, "%d", from_kgid(&init_user_ns, cred->fsgid));
144 144
145 /* we say which key is under construction */ 145 /* we say which key is under construction */
146 sprintf(key_str, "%d", key->serial); 146 sprintf(key_str, "%d", key->serial);
@@ -442,7 +442,7 @@ static struct key *construct_key_and_link(struct key_type *type,
442 442
443 kenter(""); 443 kenter("");
444 444
445 user = key_user_lookup(current_fsuid(), current_user_ns()); 445 user = key_user_lookup(current_fsuid());
446 if (!user) 446 if (!user)
447 return ERR_PTR(-ENOMEM); 447 return ERR_PTR(-ENOMEM);
448 448