Skip to content

Commit

Permalink
[CIFS] Add uid to key description so krb can handle user mounts
Browse files Browse the repository at this point in the history
Adds uid to key description fro supporting user mounts
and minor formating changes

Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
  • Loading branch information
Igor Mammedov authored and Steve French committed Nov 8, 2007
1 parent 63d2583 commit 9eae8a8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions fs/cifs/cifs_spnego.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
struct key *spnego_key;


/* version + ;ip{4|6}= + address + ;host=hostname + ;sec= + NULL */
desc_len = 2 + 5 + 32 + 1 + 5 + strlen(hostname) +
strlen(";sec=krb5") + 1;
/* version + ;ip{4|6}= + address + ;host=hostname +
;sec= + ;uid= + NULL */
desc_len = 4 + 5 + 32 + 1 + 5 + strlen(hostname) +
strlen(";sec=krb5") + 7 + sizeof(uid_t)*2 + 1;
spnego_key = ERR_PTR(-ENOMEM);
description = kzalloc(desc_len, GFP_KERNEL);
if (description == NULL)
Expand All @@ -87,7 +88,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
dp = description;
/* start with version and hostname portion of UNC string */
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);
dp = description + strlen(description);

Expand All @@ -109,6 +110,9 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
else
goto out;

dp = description + strlen(description);
sprintf(dp, ";uid=0x%x", sesInfo->linux_uid);

cFYI(1, ("key description = %s", description));
spnego_key = request_key(&cifs_spnego_key_type, description, "");

Expand Down

0 comments on commit 9eae8a8

Please sign in to comment.