Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108076
b: refs/heads/master
c: 66b8bd3
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Layton authored and Steve French committed Aug 1, 2008
1 parent 358b491 commit 3e8cd96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2f0e58ac3ad0bb2ec0924dc11f8e55d01f44ca90
refs/heads/master: 66b8bd3c405389213de1d6ba6c2565990f62004f
18 changes: 11 additions & 7 deletions trunk/fs/cifs/cifs_spnego.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ struct key_type cifs_spnego_key_type = {
.describe = user_describe,
};

#define MAX_VER_STR_LEN 9 /* length of longest version string e.g.
strlen(";ver=0xFF") */
#define MAX_VER_STR_LEN 8 /* 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 */
Expand All @@ -81,11 +81,15 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
struct key *spnego_key;
const char *hostname = server->hostname;

/* BB: come up with better scheme for determining length */
/* length of fields (with semicolons): ver=0xyz ipv4= ipaddress host=
hostname sec=mechanism uid=0x uid */
desc_len = MAX_VER_STR_LEN + 5 + MAX_IPV6_ADDR_LEN + 1 + 6 +
strlen(hostname) + MAX_MECH_STR_LEN + 8 + (sizeof(uid_t) * 2);
/* length of fields (with semicolons): ver=0xyz ip4=ipaddress
host=hostname sec=mechanism uid=0xFF user=username */
desc_len = MAX_VER_STR_LEN +
6 /* len of "host=" */ + strlen(hostname) +
5 /* len of ";ipv4=" */ + MAX_IPV6_ADDR_LEN +
MAX_MECH_STR_LEN +
7 /* len of ";uid=0x" */ + (sizeof(uid_t) * 2) +
6 /* len of ";user=" */ + strlen(sesInfo->userName) + 1;

spnego_key = ERR_PTR(-ENOMEM);
description = kzalloc(desc_len, GFP_KERNEL);
if (description == NULL)
Expand Down

0 comments on commit 3e8cd96

Please sign in to comment.