From patchwork Tue Jun 25 15:44:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 2777751 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1EE709F245 for ; Tue, 25 Jun 2013 15:48:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01D7D201EA for ; Tue, 25 Jun 2013 15:48:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE31220198 for ; Tue, 25 Jun 2013 15:48:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751269Ab3FYPss (ORCPT ); Tue, 25 Jun 2013 11:48:48 -0400 Received: from mail-gh0-f174.google.com ([209.85.160.174]:42695 "EHLO mail-gh0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751201Ab3FYPsr (ORCPT ); Tue, 25 Jun 2013 11:48:47 -0400 Received: by mail-gh0-f174.google.com with SMTP id r17so4031638ghr.5 for ; Tue, 25 Jun 2013 08:48:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=kJoqs77hxTBt+FY/xTspnBrDNygwirfM0meKtW4EyL0=; b=HlbTu/dPFvkYlB6WYG9xIOY4beqdyz9oy4KsjHSXNdXN4rrG+0WSa+NZK0RTbCLel/ GLffBR61VW3cs1Mib/TVkJr+4Q6+tLx1L6xMaXnCxcK4ZF6k/gvrHFQg9tocivbhSxLm ZrUAl8rU1yozMv4/TodJ3mQbjq/ZwAP6/5xv5bqx/XSgzsUpuLhYkKjO/clxotzh26kN /yN3O7BDHkZuv7HzuRTQ5cnDHfNMHCiI97iM2YphOqQIZtLb2dEda/6Hl7tleqH601Cp zpCbP9f62T9sRVa0TAH2wCwBia9fpIV0lT3z8BFYlbxSRZ7leLfWYpxK5GmcmG6mkl+m R/XQ== X-Received: by 10.236.125.231 with SMTP id z67mr14039848yhh.173.1372174945837; Tue, 25 Jun 2013 08:42:25 -0700 (PDT) Received: from localhost ([32.97.110.50]) by mx.google.com with ESMTPSA id f30sm38472449yhi.21.2013.06.25.08.42.23 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 25 Jun 2013 08:42:24 -0700 (PDT) From: shirishpargaonkar@gmail.com To: smfrench@gmail.com Cc: stable@kernel.org, linux-cifs@vger.kernel.org, Shirish Pargaonkar Subject: [PATCH] cifs: Handle big endianness in NTLM (ntlmv2) authentication Date: Tue, 25 Jun 2013 10:44:37 -0500 Message-Id: <1372175077-12846-1-git-send-email-shirishpargaonkar@gmail.com> X-Mailer: git-send-email 1.6.0.2 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shirish Pargaonkar 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. Reported-by: steve Signed-off-by: Shirish Pargaonkar Cc: Reviewed-by: Jeff Layton --- fs/cifs/cifs_unicode.h | 2 +- fs/cifs/cifsencrypt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/cifs/cifs_unicode.h b/fs/cifs/cifs_unicode.h index 4fb0974..bec1137 100644 --- a/fs/cifs/cifs_unicode.h +++ b/fs/cifs/cifs_unicode.h @@ -334,7 +334,7 @@ UniStrupr(register wchar_t *upin) up = upin; while (*up) { /* For all characters */ - *up = UniToupper(*up); + *up = cpu_to_le16(UniToupper(le16_to_cpu(*up))); up++; } return upin; /* Return input pointer */ diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 71436d1..8b34a73 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c @@ -439,7 +439,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, return rc; } - /* convert ses->user_name to unicode and uppercase */ + /* convert ses->user_name to unicode */ len = ses->user_name ? strlen(ses->user_name) : 0; user = kmalloc(2 + (len * 2), GFP_KERNEL); if (user == NULL) {