diff options
author | Jeff Layton <jlayton@redhat.com> | 2008-08-01 13:54:32 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-08-01 13:54:32 -0400 |
commit | 66b8bd3c405389213de1d6ba6c2565990f62004f (patch) | |
tree | ad86ef9c908944932beb5a3182b79a0148d06465 /fs/cifs | |
parent | 2f0e58ac3ad0bb2ec0924dc11f8e55d01f44ca90 (diff) |
[CIFS] properly account for new user= field in SPNEGO upcall string allocation
...it doesn't look like it's being accounted for at the moment. Also
try to reorganize the calculation to make it a little more evident
what each piece means.
This should probably go to the stable series as well...
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifs_spnego.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c index 7013aaff6aed..2434ab0e8791 100644 --- a/fs/cifs/cifs_spnego.c +++ b/fs/cifs/cifs_spnego.c | |||
@@ -66,8 +66,8 @@ 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. | 69 | #define MAX_VER_STR_LEN 8 /* length of longest version string e.g. |
70 | strlen(";ver=0xFF") */ | 70 | strlen("ver=0xFF") */ |
71 | #define MAX_MECH_STR_LEN 13 /* length of longest security mechanism name, eg | 71 | #define MAX_MECH_STR_LEN 13 /* length of longest security mechanism name, eg |
72 | in future could have strlen(";sec=ntlmsspi") */ | 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 */ | 73 | #define MAX_IPV6_ADDR_LEN 42 /* eg FEDC:BA98:7654:3210:FEDC:BA98:7654:3210/60 */ |
@@ -81,11 +81,15 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo) | |||
81 | struct key *spnego_key; | 81 | struct key *spnego_key; |
82 | const char *hostname = server->hostname; | 82 | const char *hostname = server->hostname; |
83 | 83 | ||
84 | /* BB: come up with better scheme for determining length */ | 84 | /* length of fields (with semicolons): ver=0xyz ip4=ipaddress |
85 | /* length of fields (with semicolons): ver=0xyz ipv4= ipaddress host= | 85 | host=hostname sec=mechanism uid=0xFF user=username */ |
86 | hostname sec=mechanism uid=0x uid */ | 86 | desc_len = MAX_VER_STR_LEN + |
87 | desc_len = MAX_VER_STR_LEN + 5 + MAX_IPV6_ADDR_LEN + 1 + 6 + | 87 | 6 /* len of "host=" */ + strlen(hostname) + |
88 | strlen(hostname) + MAX_MECH_STR_LEN + 8 + (sizeof(uid_t) * 2); | 88 | 5 /* len of ";ipv4=" */ + MAX_IPV6_ADDR_LEN + |
89 | MAX_MECH_STR_LEN + | ||
90 | 7 /* len of ";uid=0x" */ + (sizeof(uid_t) * 2) + | ||
91 | 6 /* len of ";user=" */ + strlen(sesInfo->userName) + 1; | ||
92 | |||
89 | spnego_key = ERR_PTR(-ENOMEM); | 93 | spnego_key = ERR_PTR(-ENOMEM); |
90 | description = kzalloc(desc_len, GFP_KERNEL); | 94 | description = kzalloc(desc_len, GFP_KERNEL); |
91 | if (description == NULL) | 95 | if (description == NULL) |