Skip to content

Commit

Permalink
Merge branch 'master' of git+ssh://git.samba.org/data/git/sfrench/cif…
Browse files Browse the repository at this point in the history
…s-2.6
  • Loading branch information
Steve French committed Jan 18, 2012
2 parents dcd169b + 789b458 commit 34f598c
Show file tree
Hide file tree
Showing 8 changed files with 312 additions and 63 deletions.
11 changes: 10 additions & 1 deletion fs/cifs/cifs_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,14 +676,23 @@ static ssize_t cifs_multiuser_mount_proc_write(struct file *file,
{
char c;
int rc;
static bool warned;

rc = get_user(c, buffer);
if (rc)
return rc;
if (c == '0' || c == 'n' || c == 'N')
multiuser_mount = 0;
else if (c == '1' || c == 'y' || c == 'Y')
else if (c == '1' || c == 'y' || c == 'Y') {
multiuser_mount = 1;
if (!warned) {
warned = true;
printk(KERN_WARNING "CIFS VFS: The legacy multiuser "
"mount code is scheduled to be deprecated in "
"3.5. Please switch to using the multiuser "
"mount option.");
}
}

return count;
}
Expand Down
10 changes: 7 additions & 3 deletions fs/cifs/cifs_spnego.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,11 @@ cifs_get_spnego_key(struct cifs_ses *sesInfo)
MAX_MECH_STR_LEN +
UID_KEY_LEN + (sizeof(uid_t) * 2) +
CREDUID_KEY_LEN + (sizeof(uid_t) * 2) +
USER_KEY_LEN + strlen(sesInfo->user_name) +
PID_KEY_LEN + (sizeof(pid_t) * 2) + 1;

if (sesInfo->user_name)
desc_len += USER_KEY_LEN + strlen(sesInfo->user_name);

spnego_key = ERR_PTR(-ENOMEM);
description = kzalloc(desc_len, GFP_KERNEL);
if (description == NULL)
Expand Down Expand Up @@ -152,8 +154,10 @@ cifs_get_spnego_key(struct cifs_ses *sesInfo)
dp = description + strlen(description);
sprintf(dp, ";creduid=0x%x", sesInfo->cred_uid);

dp = description + strlen(description);
sprintf(dp, ";user=%s", sesInfo->user_name);
if (sesInfo->user_name) {
dp = description + strlen(description);
sprintf(dp, ";user=%s", sesInfo->user_name);
}

dp = description + strlen(description);
sprintf(dp, ";pid=0x%x", current->pid);
Expand Down
11 changes: 8 additions & 3 deletions fs/cifs/cifsencrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,15 +420,20 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
}

/* convert ses->user_name to unicode and uppercase */
len = strlen(ses->user_name);
len = ses->user_name ? strlen(ses->user_name) : 0;
user = kmalloc(2 + (len * 2), GFP_KERNEL);
if (user == NULL) {
cERROR(1, "calc_ntlmv2_hash: user mem alloc failure\n");
rc = -ENOMEM;
return rc;
}
len = cifs_strtoUCS((__le16 *)user, ses->user_name, len, nls_cp);
UniStrupr(user);

if (len) {
len = cifs_strtoUCS((__le16 *)user, ses->user_name, len, nls_cp);
UniStrupr(user);
} else {
memset(user, '\0', 2);
}

rc = crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash,
(char *)user, 2 * len);
Expand Down
Loading

0 comments on commit 34f598c

Please sign in to comment.