Commit 9eae8a89 authored by Igor Mammedov's avatar Igor Mammedov Committed by Steve French

[CIFS] Add uid to key description so krb can handle user mounts

Adds uid to key description fro supporting user mounts
and minor formating changes
Acked-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarIgor Mammedov <niallain@gmail.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 63d2583f
...@@ -76,9 +76,10 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname) ...@@ -76,9 +76,10 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
struct key *spnego_key; struct key *spnego_key;
/* version + ;ip{4|6}= + address + ;host=hostname + ;sec= + NULL */ /* version + ;ip{4|6}= + address + ;host=hostname +
desc_len = 2 + 5 + 32 + 1 + 5 + strlen(hostname) + ;sec= + ;uid= + NULL */
strlen(";sec=krb5") + 1; desc_len = 4 + 5 + 32 + 1 + 5 + strlen(hostname) +
strlen(";sec=krb5") + 7 + sizeof(uid_t)*2 + 1;
spnego_key = ERR_PTR(-ENOMEM); spnego_key = ERR_PTR(-ENOMEM);
description = kzalloc(desc_len, GFP_KERNEL); description = kzalloc(desc_len, GFP_KERNEL);
if (description == NULL) if (description == NULL)
...@@ -87,7 +88,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname) ...@@ -87,7 +88,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
dp = description; dp = description;
/* start with version and hostname portion of UNC string */ /* start with version and hostname portion of UNC string */
spnego_key = ERR_PTR(-EINVAL); spnego_key = ERR_PTR(-EINVAL);
sprintf(dp, "%2.2x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION, sprintf(dp, "0x%2.2x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION,
hostname); hostname);
dp = description + strlen(description); dp = description + strlen(description);
...@@ -109,6 +110,9 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname) ...@@ -109,6 +110,9 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
else else
goto out; goto out;
dp = description + strlen(description);
sprintf(dp, ";uid=0x%x", sesInfo->linux_uid);
cFYI(1, ("key description = %s", description)); cFYI(1, ("key description = %s", description));
spnego_key = request_key(&cifs_spnego_key_type, description, ""); spnego_key = request_key(&cifs_spnego_key_type, description, "");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment