2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-19 10:44:14 +08:00

SMB3.1.1: Fix ids returned in POSIX query dir

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 <stable@vger.kernel.org>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Steve French 2020-10-20 02:02:02 -05:00
parent 9eec21bfbe
commit 9934430e21
3 changed files with 7 additions and 5 deletions

View File

@ -338,7 +338,7 @@ invalidate_key:
goto out_key_put; goto out_key_put;
} }
static int int
sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid, sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
struct cifs_fattr *fattr, uint sidtype) struct cifs_fattr *fattr, uint sidtype)
{ {
@ -359,7 +359,8 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
return -EIO; 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; uint32_t unix_id;
bool is_group; bool is_group;

View File

@ -209,6 +209,8 @@ extern int cifs_set_file_info(struct inode *inode, struct iattr *attrs,
extern int cifs_rename_pending_delete(const char *full_path, extern int cifs_rename_pending_delete(const char *full_path,
struct dentry *dentry, struct dentry *dentry,
const unsigned int xid); 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, extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
struct cifs_fattr *fattr, struct inode *inode, struct cifs_fattr *fattr, struct inode *inode,
bool get_mode_from_special_sid, bool get_mode_from_special_sid,

View File

@ -267,9 +267,8 @@ cifs_posix_to_fattr(struct cifs_fattr *fattr, struct smb2_posix_info *info,
if (reparse_file_needs_reval(fattr)) if (reparse_file_needs_reval(fattr))
fattr->cf_flags |= CIFS_FATTR_NEED_REVAL; fattr->cf_flags |= CIFS_FATTR_NEED_REVAL;
/* TODO map SIDs */ sid_to_id(cifs_sb, &parsed.owner, fattr, SIDOWNER);
fattr->cf_uid = cifs_sb->mnt_uid; sid_to_id(cifs_sb, &parsed.group, fattr, SIDGROUP);
fattr->cf_gid = cifs_sb->mnt_gid;
} }
static void __dir_info_to_fattr(struct cifs_fattr *fattr, const void *info) static void __dir_info_to_fattr(struct cifs_fattr *fattr, const void *info)