Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp242879pxx; Wed, 28 Oct 2020 03:55:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvIb7VK4fcqUvMYw2B693+oRUweVbh6jjXpLScJRDT0BHm+RdO96IMTEf18Y5APxE3Wqvk X-Received: by 2002:a17:906:5f96:: with SMTP id a22mr6808385eju.168.1603882514459; Wed, 28 Oct 2020 03:55:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603882514; cv=none; d=google.com; s=arc-20160816; b=TbTD1SWMbQVLasHj2hGUIJVckfrD6hvQ+4N1V2Ulw50BxC6FxuWcUjBB6Bnd5adtaZ IOAZO3NJckqL2qtoSPuJljveBoC3B4DKjy6cr6ZqCQbYShIDka9Q4l8iFhl4d/iF0yFX pGbsy8FdZTzA4TPI52LIQMWmS6Kxl0LmEv47Z8wtdxACqx6Vu94FPh93dUA8CUfHcU3n yX4YGgIqtrbjeyKIxLjGmS6rKkU/La46iwVaN+DXZ5JyCz9+twLnoM9/Q2XAbCKJR7A3 qfmtpiuGwl/mXQjy5T8o3I+AM9+4cZ4QBxHfU948+e8LQJK8yWvV+Ov1n96n8MTgkitc GUFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GQNLVhxu4EoeAw/bKOUie9Q5KxJGMnswxQ9FHFToIeE=; b=E0po0V2ZzoyjooHWwwA6bEF5xync8wv1DiKg28jr9Gq4eMn5KesaJqro0umJbGZbgO F9uUByunZLWeIcq8xVWlX0qeesN3l7uD0QgHGZs7f8wVRCL7zJ9Fj2/zoIuiknttqlAp eJ+wELhxEZMoTXIfn07gsgXmcWRPmsyLG+WMuy9ybaChtbq2Y/dIfulVdKPS4oskQMkQ IFYPT+AxZAoZFaBRZ+XSTjKZx8dB1xQiJWLmWZbLV5fV1NGtIhc+/nro+WZSw1HyAcqg KfHidI/nMaoQJm1IpSAZxMqey+mRaNBz4Y3nO21Ic9dvCHsE1gyiXjZO0zkf/n52kRdu uP1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YJ2A5wFR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b29si2827715edn.354.2020.10.28.03.54.52; Wed, 28 Oct 2020 03:55:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YJ2A5wFR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1781305AbgJ0Ozd (ORCPT + 99 others); Tue, 27 Oct 2020 10:55:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:50180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1772899AbgJ0Ou1 (ORCPT ); Tue, 27 Oct 2020 10:50:27 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 888FA20709; Tue, 27 Oct 2020 14:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810227; bh=U9XkeznRaBRhcxUYAB0DI2V9noC0os5Uhj8gTDfDIXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YJ2A5wFRdn/A+eyOVKvBMxNkOV9HNDCRN9ZfWgwWTCQDKij925z9FOLyIwDCrf+b7 wMBoh6yl7zsUuPO5M0uj7jB1rQD3dZijXLpY3jcbdx64BokmRScC1Z0DU9wQE0rrHQ XdCp37DITEU4Z4zTjjHSL3NyUQx1qw46YrC7iiOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aurelien Aptel , Steve French Subject: [PATCH 5.8 065/633] SMB3.1.1: Fix ids returned in POSIX query dir Date: Tue, 27 Oct 2020 14:46:48 +0100 Message-Id: <20201027135525.748467921@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steve French commit 9934430e2178d5164eb1ac91a9b092f9e7e64745 upstream. We were setting the uid/gid to the default in each dir entry in the parsing of the POSIX query dir response, rather than attempting to map the user and group SIDs returned by the server to well known SIDs (or upcall if not found). CC: Stable Reviewed-by: Aurelien Aptel Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/cifsacl.c | 5 +++-- fs/cifs/cifsproto.h | 2 ++ fs/cifs/readdir.c | 5 ++--- 3 files changed, 7 insertions(+), 5 deletions(-) --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c @@ -338,7 +338,7 @@ invalidate_key: goto out_key_put; } -static int +int sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid, struct cifs_fattr *fattr, uint sidtype) { @@ -359,7 +359,8 @@ sid_to_id(struct cifs_sb_info *cifs_sb, return -EIO; } - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UID_FROM_ACL) { + if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UID_FROM_ACL) || + (cifs_sb_master_tcon(cifs_sb)->posix_extensions)) { uint32_t unix_id; bool is_group; --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -208,6 +208,8 @@ extern int cifs_set_file_info(struct ino extern int cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, const unsigned int xid); +extern int sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid, + struct cifs_fattr *fattr, uint sidtype); extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, struct inode *inode, bool get_mode_from_special_sid, --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c @@ -267,9 +267,8 @@ cifs_posix_to_fattr(struct cifs_fattr *f if (reparse_file_needs_reval(fattr)) fattr->cf_flags |= CIFS_FATTR_NEED_REVAL; - /* TODO map SIDs */ - fattr->cf_uid = cifs_sb->mnt_uid; - fattr->cf_gid = cifs_sb->mnt_gid; + sid_to_id(cifs_sb, &parsed.owner, fattr, SIDOWNER); + sid_to_id(cifs_sb, &parsed.group, fattr, SIDGROUP); } static void __dir_info_to_fattr(struct cifs_fattr *fattr, const void *info)