aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifs_spnego.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-11-16 13:32:52 -0500
committerSteve French <sfrench@us.ibm.com>2007-11-16 13:32:52 -0500
commit68bf728a225b7f2045bb501854d6e7695b9b015d (patch)
tree0ee540a84c48e488e67ae6cc41dd3f9af61b9016 /fs/cifs/cifs_spnego.c
parent133672efbc1085f9af990bdc145e1822ea93bcf3 (diff)
[CIFS] add ver= prefix to upcall format version
Acked-by: Jeff Layton <jlayton@redhat.com> Acked-by: Igor Mammedov <niallan@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifs_spnego.c')
-rw-r--r--fs/cifs/cifs_spnego.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c
index ad54a3a6e434..d79eee41e9c5 100644
--- a/fs/cifs/cifs_spnego.c
+++ b/fs/cifs/cifs_spnego.c
@@ -66,6 +66,11 @@ struct key_type cifs_spnego_key_type = {
66 .describe = user_describe, 66 .describe = user_describe,
67}; 67};
68 68
69#define MAX_VER_STR_LEN 9 /* length of longest version string e.g.
70 strlen(";ver=0xFF) */
71#define MAX_MECH_STR_LEN 13 /* length of longest security mechanism name, eg
72 in future could have strlen(";sec=ntlmsspi") */
73#define MAX_IPV6_ADDR_LEN 42 /* eg FEDC:BA98:7654:3210:FEDC:BA98:7654:3210/60 */
69/* get a key struct with a SPNEGO security blob, suitable for session setup */ 74/* get a key struct with a SPNEGO security blob, suitable for session setup */
70struct key * 75struct key *
71cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname) 76cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
@@ -75,11 +80,11 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
75 size_t desc_len; 80 size_t desc_len;
76 struct key *spnego_key; 81 struct key *spnego_key;
77 82
78 83 /* BB: come up with better scheme for determining length */
79 /* version + ;ip{4|6}= + address + ;host=hostname + 84 /* length of fields (with semicolons): ver=0xyz ipv4= ipaddress host=
80 ;sec= + ;uid= + NULL */ 85 hostname sec=mechanism uid=0x uid */
81 desc_len = 4 + 5 + 32 + 1 + 5 + strlen(hostname) + 86 desc_len = MAX_VER_STR_LEN + 5 + MAX_IPV6_ADDR_LEN + 1 + 6 +
82 strlen(";sec=krb5") + 7 + sizeof(uid_t)*2 + 1; 87 strlen(hostname) + MAX_MECH_STR_LEN + 8 + (sizeof(uid_t) * 2);
83 spnego_key = ERR_PTR(-ENOMEM); 88 spnego_key = ERR_PTR(-ENOMEM);
84 description = kzalloc(desc_len, GFP_KERNEL); 89 description = kzalloc(desc_len, GFP_KERNEL);
85 if (description == NULL) 90 if (description == NULL)
@@ -88,7 +93,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
88 dp = description; 93 dp = description;
89 /* start with version and hostname portion of UNC string */ 94 /* start with version and hostname portion of UNC string */
90 spnego_key = ERR_PTR(-EINVAL); 95 spnego_key = ERR_PTR(-EINVAL);
91 sprintf(dp, "0x%2.2x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION, 96 sprintf(dp, "ver=0x%x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION,
92 hostname); 97 hostname);
93 dp = description + strlen(description); 98 dp = description + strlen(description);
94 99