Commit 68bf728a authored by Steve French's avatar Steve French

[CIFS] add ver= prefix to upcall format version

Acked-by: default avatarJeff Layton <jlayton@redhat.com>
Acked-by: default avatarIgor Mammedov <niallan@gmail.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 133672ef
...@@ -66,6 +66,11 @@ struct key_type cifs_spnego_key_type = { ...@@ -66,6 +66,11 @@ struct key_type cifs_spnego_key_type = {
.describe = user_describe, .describe = user_describe,
}; };
#define MAX_VER_STR_LEN 9 /* length of longest version string e.g.
strlen(";ver=0xFF) */
#define MAX_MECH_STR_LEN 13 /* length of longest security mechanism name, eg
in future could have strlen(";sec=ntlmsspi") */
#define MAX_IPV6_ADDR_LEN 42 /* eg FEDC:BA98:7654:3210:FEDC:BA98:7654:3210/60 */
/* get a key struct with a SPNEGO security blob, suitable for session setup */ /* get a key struct with a SPNEGO security blob, suitable for session setup */
struct key * struct key *
cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname) cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
...@@ -75,11 +80,11 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname) ...@@ -75,11 +80,11 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
size_t desc_len; size_t desc_len;
struct key *spnego_key; struct key *spnego_key;
/* BB: come up with better scheme for determining length */
/* version + ;ip{4|6}= + address + ;host=hostname + /* length of fields (with semicolons): ver=0xyz ipv4= ipaddress host=
;sec= + ;uid= + NULL */ hostname sec=mechanism uid=0x uid */
desc_len = 4 + 5 + 32 + 1 + 5 + strlen(hostname) + desc_len = MAX_VER_STR_LEN + 5 + MAX_IPV6_ADDR_LEN + 1 + 6 +
strlen(";sec=krb5") + 7 + sizeof(uid_t)*2 + 1; strlen(hostname) + MAX_MECH_STR_LEN + 8 + (sizeof(uid_t) * 2);
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)
...@@ -88,7 +93,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname) ...@@ -88,7 +93,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, "0x%2.2x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION, sprintf(dp, "ver=0x%x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION,
hostname); hostname);
dp = description + strlen(description); dp = description + strlen(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