From patchwork Wed Dec 8 17:13:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 391542 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 oB8HOMn5022480 for ; Wed, 8 Dec 2010 17:24:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755122Ab0LHRYV (ORCPT ); Wed, 8 Dec 2010 12:24:21 -0500 Received: from mail-qy0-f177.google.com ([209.85.216.177]:47122 "EHLO mail-qy0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755064Ab0LHRYU (ORCPT ); Wed, 8 Dec 2010 12:24:20 -0500 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 17:24:22 +0000 (UTC) X-Greylist: delayed 342 seconds by postgrey-1.27 at vger.kernel.org; Wed, 08 Dec 2010 12:24:20 EST Received: by qyk27 with SMTP id 27so737417qyk.1 for ; Wed, 08 Dec 2010 09:24:20 -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=dwgf/FEb7+mqFm/gQAwX03JeNx3lMcCBtD+epIc4dL8=; b=P4KeORaRShWECe1/nFcK6JCWSmGRsHBfMy6RXSnNtrj64dSgUxkBQ2FsECnVbIa3ew zt6Um6ryMU1KeeH05jWc8j3vzFQMXlwwb+TJMrkkBcYmVbCS1nXisc29fNiZ48c+ECjK 7i4RrZLmUanj53wLpSfNq5aA0jZv/8zmdtdWg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=otFBI8Rh38KzwrQe13CTQi/mypZn1zuQx2HM47hStRqtCYTGS9wV+JcUMivRj3QNS1 abQlOETJB4i28ml+yCqre3E3QSjJZ+aJMZQWFuiso/WvE1g7eScDuyMFruyP0P2gAsWs i6iwJTNlOCxCIlD4AvvXTUKHu1KTFeGtiG1FQ= Received: by 10.224.54.142 with SMTP id q14mr1624134qag.351.1291828717818; Wed, 08 Dec 2010 09:18:37 -0800 (PST) Received: from localhost ([32.97.110.58]) by mx.google.com with ESMTPS id u2sm487155qcq.19.2010.12.08.09.18.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 08 Dec 2010 09:18:37 -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 [try #2] Date: Wed, 8 Dec 2010 11:13:18 -0600 Message-Id: <1291828398-27336-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 diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 7b01d3f..44c2989 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);