aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsencrypt.c
diff options
context:
space:
mode:
authorSteve French <smfrench@us.ibm.com>2013-06-25 15:03:16 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-21 21:21:36 -0400
commite885d8b8a8ff435d4fcb66c7376e349c4658621d (patch)
tree75d19b0b97f73c459f981e50877a76b7e8692d9d /fs/cifs/cifsencrypt.c
parent7642257802319a58c118649e20ad5c7ee0d663f3 (diff)
Handle big endianness in NTLM (ntlmv2) authentication
commit fdf96a907c1fbb93c633e2b7ede3b8df26d6a4c0 upstream. This is RH bug 970891 Uppercasing of username during calculation of ntlmv2 hash fails because UniStrupr function does not handle big endian wchars. Also fix a comment in the same code to reflect its correct usage. [To make it easier for stable (rather than require 2nd patch) fixed this patch of Shirish's to remove endian warning generated by sparse -- steve f.] Reported-by: steve <sanpatr1@in.ibm.com> Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/cifs/cifsencrypt.c')
-rw-r--r--fs/cifs/cifsencrypt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 71436d1fca13..f59d0d58258e 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -414,7 +414,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
414 int rc = 0; 414 int rc = 0;
415 int len; 415 int len;
416 char nt_hash[CIFS_NTHASH_SIZE]; 416 char nt_hash[CIFS_NTHASH_SIZE];
417 wchar_t *user; 417 __le16 *user;
418 wchar_t *domain; 418 wchar_t *domain;
419 wchar_t *server; 419 wchar_t *server;
420 420
@@ -439,7 +439,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
439 return rc; 439 return rc;
440 } 440 }
441 441
442 /* convert ses->user_name to unicode and uppercase */ 442 /* convert ses->user_name to unicode */
443 len = ses->user_name ? strlen(ses->user_name) : 0; 443 len = ses->user_name ? strlen(ses->user_name) : 0;
444 user = kmalloc(2 + (len * 2), GFP_KERNEL); 444 user = kmalloc(2 + (len * 2), GFP_KERNEL);
445 if (user == NULL) { 445 if (user == NULL) {
@@ -448,7 +448,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
448 } 448 }
449 449
450 if (len) { 450 if (len) {
451 len = cifs_strtoUTF16((__le16 *)user, ses->user_name, len, nls_cp); 451 len = cifs_strtoUTF16(user, ses->user_name, len, nls_cp);
452 UniStrupr(user); 452 UniStrupr(user);
453 } else { 453 } else {
454 memset(user, '\0', 2); 454 memset(user, '\0', 2);