From patchwork Wed Dec 8 15:41:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 390962 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB8FkQI0010847 for ; Wed, 8 Dec 2010 15:46:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756006Ab0LHPqZ (ORCPT ); Wed, 8 Dec 2010 10:46:25 -0500 Received: from mail-gy0-f174.google.com ([209.85.160.174]:46855 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755981Ab0LHPqZ (ORCPT ); Wed, 8 Dec 2010 10:46:25 -0500 Received: by gyb11 with SMTP id 11so727066gyb.19 for ; Wed, 08 Dec 2010 07:46:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=rPwW/kaaqwAaDfRTCjjSysDeAVWgHSYK/AYf4V7NZjY=; b=N0VtVvL+Q9dF+aJA9X9oJyybC0PiWvBVU4uPpE4T3JyMjBb+ZkrHDPpTpakIVBUpiX uafvopVVH4Qx7VzVLclmbrM6RqVBRwKAGVbWy1nbdSgTN9RFNDaSikctN6lYEl4CoxKr +UGtzpK33uZYQpO3eSwpJxb7OQ9NoiCD2UFbs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=OjZLfTMcA4bbHUlE2Z2tl/mDuNR00bAQXDoFuj3fsPWNTV4FC34f7QX5a7RdJNl5mK c3H52WVnemmJLIQ2Fgq0H0JYGmPfvXDo4j1g2XSxcbbP8s0P8siYWeyfaG6jOCvhcKTd BWTXqG9WzRPunNROUOzVyg+0wba3xcLJhE36g= Received: by 10.100.141.16 with SMTP id o16mr5964198and.71.1291823184633; Wed, 08 Dec 2010 07:46:24 -0800 (PST) Received: from localhost ([32.97.110.58]) by mx.google.com with ESMTPS id 37sm801788anr.24.2010.12.08.07.46.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 08 Dec 2010 07:46:24 -0800 (PST) From: shirishpargaonkar@gmail.com To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, Shirish Pargaonkar Subject: [PATCH] cifs: Support NTLM2 session security during NTLMSSP authentication Date: Wed, 8 Dec 2010 09:41:05 -0600 Message-Id: <1291822865-26472-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-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 08 Dec 2010 15:46:27 +0000 (UTC) diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 7b01d3f..122ad31 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -437,7 +437,7 @@ static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer, /* BB is NTLMV2 session security format easier to use here? */ flags = NTLMSSP_NEGOTIATE_56 | NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE | - NTLMSSP_NEGOTIATE_NTLM; + NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC; if (ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) { flags |= NTLMSSP_NEGOTIATE_SIGN; @@ -544,8 +544,9 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer, sec_blob->WorkstationName.MaximumLength = 0; tmp += 2; - if ((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) && - !calc_seckey(ses)) { + if (((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) || + ((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_EXTENDED_SEC))) + && !calc_seckey(ses)) { memcpy(tmp, ses->ntlmssp->ciphertext, CIFS_CPHTXT_SIZE); sec_blob->SessionKey.BufferOffset = cpu_to_le32(tmp - pbuffer); sec_blob->SessionKey.Length = cpu_to_le16(CIFS_CPHTXT_SIZE);