From patchwork Wed Dec 3 12:26:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Prabhu X-Patchwork-Id: 5430291 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 C59A49F1C5 for ; Wed, 3 Dec 2014 12:26:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9911E202EC for ; Wed, 3 Dec 2014 12:26:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66281202B8 for ; Wed, 3 Dec 2014 12:26:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751086AbaLCM0k (ORCPT ); Wed, 3 Dec 2014 07:26:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43025 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751509AbaLCM0k (ORCPT ); Wed, 3 Dec 2014 07:26:40 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB3CQdgp032741 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 3 Dec 2014 07:26:40 -0500 Received: from sachin-laptop.redhat.com (vpn1-4-103.ams2.redhat.com [10.36.4.103]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sB3CQbDF007747 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 3 Dec 2014 07:26:39 -0500 From: Sachin Prabhu To: linux-cifs Subject: [PATCH] Set UID in sess_auth_rawntlmssp_authenticate too Date: Wed, 3 Dec 2014 12:26:36 +0000 Message-Id: <1417609596-23002-1-git-send-email-sprabhu@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 A user complained that they were unable to login to their cifs share after a kernel update. From the wiretrace we can see that the server returns different UIDs as response to NTLMSSP_NEGOTIATE and NTLMSSP_AUTH phases. With changes in the authentication code, we no longer set the cifs_sess->Suid returned in response to the NTLM_AUTH phase and continue to use the UID sent in response to the NTLMSSP_NEGOTIATE phase. This results in the server denying access to the user when the user attempts to do a tcon connect. A test kernel containing patch was tested successfully by the user. Signed-off-by: Sachin Prabhu Acked-by: Shirish Pargaonkar --- fs/cifs/sess.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 57db63f..446cb7f 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -1303,6 +1303,11 @@ sess_auth_rawntlmssp_authenticate(struct sess_data *sess_data) if (le16_to_cpu(pSMB->resp.Action) & GUEST_LOGIN) cifs_dbg(FYI, "Guest login\n"); /* BB mark SesInfo struct? */ + if (ses->Suid != smb_buf->Uid) { + ses->Suid = smb_buf->Uid; + cifs_dbg(FYI, "UID changed! new UID = %llu\n", ses->Suid); + } + bytes_remaining = get_bcc(smb_buf); bcc_ptr = pByteArea(smb_buf); blob_len = le16_to_cpu(pSMB->resp.SecurityBlobLength);