From patchwork Wed Aug 24 01:16:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 1090542 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7O1BJPt016435 for ; Wed, 24 Aug 2011 01:11:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756083Ab1HXBLT (ORCPT ); Tue, 23 Aug 2011 21:11:19 -0400 Received: from mail-yx0-f174.google.com ([209.85.213.174]:57510 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755483Ab1HXBLT (ORCPT ); Tue, 23 Aug 2011 21:11:19 -0400 Received: by yxj19 with SMTP id 19so535062yxj.19 for ; Tue, 23 Aug 2011 18:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=u+5CaJQheKnyCRDcrnEzwAHRdTHMAtjguTlbl5f5QpI=; b=ZWUNZWePsbJS6AhWGlLmVaXX4dFO+sdhVDR8W0iVTcRXrLXDmougZ4wtV1AYANF06e mwcnA4qx0P8ugy3ThhgvDCp8zkigH1ng8KUCFbzAuRCWjZ22iD6xqkHyV+MEQ6xJ+q4s NxD1suqeFQ/nh+HeNfgH9cF4WcgFmsPgNh5Gg= Received: by 10.150.99.2 with SMTP id w2mr4212378ybb.377.1314148278306; Tue, 23 Aug 2011 18:11:18 -0700 (PDT) Received: from localhost ([32.97.110.58]) by mx.google.com with ESMTPS id z29sm563066yhn.58.2011.08.23.18.11.16 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 23 Aug 2011 18:11:17 -0700 (PDT) From: shirishpargaonkar@gmail.com To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, Shirish Pargaonkar Subject: [PATCH] cifs: Fix broken sec=ntlmv2/i sec mount option for Samba server Date: Tue, 23 Aug 2011 20:16:52 -0500 Message-Id: <1314148612-18487-1-git-send-email-shirishpargaonkarp@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-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 24 Aug 2011 01:11:43 +0000 (UTC) From: Shirish Pargaonkar Fix sec=ntlmv2/i authentication option during mount of Samba shares. Samba server does not like timestamp field as one of the av pair elements during raw ntlmv2 authentication. Windows servers do not care whether that av pair field is used in the blob for NTLMv2 authentication. For sec=ntlmsspi, build_av_pair is not used, a blob is plucked from type 2 response sent by the server to use in authentication. I tested sec=ntlmv2/i and sec=ntlmssp/i mount options against Samba (3.6) and Windows - XP, 2003 Server and 7. They all worked. Signed-off-by: Shirish Pargaonkar --- fs/cifs/cifsencrypt.c | 9 +-------- 1 files changed, 1 insertions(+), 8 deletions(-) diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index e76bfeb..90f85af 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c @@ -353,7 +353,6 @@ build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp) unsigned int dlen; unsigned int wlen; unsigned int size = 6 * sizeof(struct ntlmssp2_name); - __le64 curtime; char *defdmname = "WORKGROUP"; unsigned char *blobptr; struct ntlmssp2_name *attrptr; @@ -373,7 +372,7 @@ build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp) * two times the unicode length of a server name + * size of a timestamp (which is 8 bytes). */ - ses->auth_key.len = size + 2 * (2 * dlen) + 2 * (2 * wlen) + 8; + ses->auth_key.len = size + 2 * (2 * dlen) + 2 * (2 * wlen); ses->auth_key.response = kzalloc(ses->auth_key.len, GFP_KERNEL); if (!ses->auth_key.response) { ses->auth_key.len = 0; @@ -416,12 +415,6 @@ build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp) blobptr += 2 * wlen; attrptr = (struct ntlmssp2_name *) blobptr; - attrptr->type = cpu_to_le16(NTLMSSP_AV_TIMESTAMP); - attrptr->length = cpu_to_le16(sizeof(__le64)); - blobptr = (unsigned char *)attrptr + sizeof(struct ntlmssp2_name); - curtime = cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); - memcpy(blobptr, &curtime, sizeof(__le64)); - return 0; }