From patchwork Fri Feb 28 07:53:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1246335 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=fe1j6Kyy; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48TMHK6bgmz9sS3 for ; Fri, 28 Feb 2020 18:53:49 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727024AbgB1Hxs (ORCPT ); Fri, 28 Feb 2020 02:53:48 -0500 Received: from mail-il1-f180.google.com ([209.85.166.180]:33694 "EHLO mail-il1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726860AbgB1Hxs (ORCPT ); Fri, 28 Feb 2020 02:53:48 -0500 Received: by mail-il1-f180.google.com with SMTP id r4so608021iln.0 for ; Thu, 27 Feb 2020 23:53:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=Dy02yBb0mcnh8Bn9VT4ief6FfryyCbEJOLSE/HWUw2g=; b=fe1j6KyyYKJwFuS/h7dC1+RtIJvKbbnf9aoWo+7Pav0eTwSldrBYm5vj3HwwRQkIJ+ aEFNZSm+mqASG21uScsuw3ugMXdKjbbk/pvcCs4QILRVMqo7qoVlnlmhFy3VKCgMKOPD g9Ie5vbHOa5ZTyON4a94bf0yj2+6Gu7iLtr8mY3aL+TzavCED5ngNBqzELxYhrUM0lII X8OmqEVwfruqnOCNzNxE4IkHBqYe9jOLgmCrJEch9Z/8QhFBFmIshv/lhNQR8xQ6bW4g 1vwbCVQY0M/XToFy7IVUqaniwS5xAOCS+tXjdI7nVLdEJYrDwgFCRmrh45cS3xK+6iv8 O3cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=Dy02yBb0mcnh8Bn9VT4ief6FfryyCbEJOLSE/HWUw2g=; b=IQZUAsBfCCo0AKsLsYsVYe0EcC6y/RUFFykpSwUQ45F2DKXW1/FBrfHFzcG64S2isx orKnXGfNBzUbueGPDDTqbt9gGH2A/Rses0NobUmSNEehF4kN7zEBxrHzuHu+oQ2FgH2R VNOY/vLYWVhg+5DjW6GbqbLpjNUYXvrE8p+KlkvKG5IXK8rqHEB2DJqc+txrlEeKPzUI BAv1ygbumEkQ4qx1xezhAynYa17JlQjMnNN4HMtcNZdUdn8wdZnSBDid/lYKLqpKjnc0 dOnM3MM2zd9I9sU14juELa2e7eiiaRD0/dnYan8lpodo0vgXHP/9h3DJEMtqXSo+pWOV 26xA== X-Gm-Message-State: APjAAAWYJNSeEKYQLny7A3JLCrlseve2pHLK18cS2jZavFPpqi1R/Zi0 ChUuuWuFVVk+kDTMGLLpldcICBJeSiYhMz+JT4QbAjDR X-Google-Smtp-Source: APXvYqzVB+GUto2mB8S1ZTvhG8nMDSnPNgl+hmFFqrH4SBad5fXrZim3Ls9PoPl3l7v/v6Cq0Uv6K/PNCYSkoBP6RD8= X-Received: by 2002:a92:cb8c:: with SMTP id z12mr3047441ilo.5.1582876427270; Thu, 27 Feb 2020 23:53:47 -0800 (PST) MIME-Version: 1.0 From: Steve French Date: Fri, 28 Feb 2020 01:53:36 -0600 Message-ID: Subject: [SMB311][PATCHES] parse posix create context in order to handle getattr To: CIFS Cc: samba-technical Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org First 1/2 of changes needed to support SMB3.1.1 POSIX Extensions support for getattr (stat) - the main remaining item left for the Linux kernel client support of the SMB3.1.1 POSIX Extensions. The patch from Aurelien allows SMB2_open() callers to pass down a POSIX data buffer that will trigger requesting POSIX create context and parsing the response into the provided buffer, and the second patch fixes some minor problems with the first patch. From 085ff186f2a9257dff66844ba00fa2b1454bad4d Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 26 Feb 2020 16:55:40 -0600 Subject: [PATCH 2/2] smb3: update the information returned on posix create/open Fix a couple minor problems with parsing the create context in the previous patch (length incorrect in one, and field name incorrect in one othe replace). And account for sids in the create posix response. Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 4 ++-- fs/cifs/smb2pdu.h | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index cfcbe6df2063..244606103d9f 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -1955,7 +1955,7 @@ parse_posix_ctxt(struct create_context *cc, struct smb2_file_all_info *info, struct create_posix_rsp *posix) { int sid_len; - u8 *beg = (u8 *)cc + le32_to_cpu(cc->DataOffset); + u8 *beg = (u8 *)cc + le16_to_cpu(cc->DataOffset); u8 *end = beg + le32_to_cpu(cc->DataLength); u8 *sid; @@ -1963,7 +1963,7 @@ parse_posix_ctxt(struct create_context *cc, struct smb2_file_all_info *info, posix->nlink = le32_to_cpu(*(__le32 *)(beg + 0)); posix->reparse_tag = le32_to_cpu(*(__le32 *)(beg + 4)); - posix->reparse_tag = le32_to_cpu(*(__le32 *)(beg + 8)); + posix->mode = le32_to_cpu(*(__le32 *)(beg + 8)); sid = beg + 12; sid_len = posix_info_sid_size(sid, end); diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index 700311978523..4653fa89e7ad 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h @@ -1603,16 +1603,18 @@ struct smb2_file_id_information { extern char smb2_padding[7]; -/* equivalent of the contents of SMB3.1.1 POSIX open context response */ +/* unpacked equivalent of contents of SMB3.1.1 POSIX open context response */ struct create_posix_rsp { - __le32 nlink; - __le32 reparse_tag; - __le32 mode; + u32 nlink; + u32 reparse_tag; + u32 mode; /* * var sized owner SID * var sized group SID */ -} __packed; + struct cifs_sid owner; + struct cifs_sid group; +}; /* * SMB2-only POSIX info level -- 2.20.1