From: Jeremy Allison Date: Wed, 23 Jun 2021 02:10:37 +0000 (-0700) Subject: s3: VFS: fake_acls: In fake_acls_stat() - if we have a pathref fsp, use it. X-Git-Tag: tevent-0.11.0~186 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2b78728514a68df29efc483ede90cd804880685;p=thirdparty%2Fsamba.git s3: VFS: fake_acls: In fake_acls_stat() - if we have a pathref fsp, use it. We will add a pathref open for the case where we don't next. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_fake_acls.c b/source3/modules/vfs_fake_acls.c index 4d1211a0649..c675479cea7 100644 --- a/source3/modules/vfs_fake_acls.c +++ b/source3/modules/vfs_fake_acls.c @@ -118,14 +118,38 @@ static int fake_acls_stat(vfs_handle_struct *handle, struct smb_filename smb_fname_base = { .base_name = smb_fname->base_name }; + struct files_struct *fsp = NULL; + + if (smb_fname->fsp != NULL) { + fsp = smb_fname->fsp; + if (fsp->base_fsp != NULL) { + /* + * This is a stream pathname. Use + * the base_fsp to get the xattr. + */ + fsp = fsp->base_fsp; + } + } - ret = fake_acls_uid(handle, &smb_fname_base, + if (fsp != NULL) { + ret = fake_acls_fuid(handle, + fsp, + &smb_fname->st.st_ex_uid); + } else { + ret = fake_acls_uid(handle, &smb_fname_base, &smb_fname->st.st_ex_uid); + } if (ret != 0) { return ret; } - ret = fake_acls_gid(handle, &smb_fname_base, + if (fsp != NULL) { + ret = fake_acls_fgid(handle, + fsp, + &smb_fname->st.st_ex_gid); + } else { + ret = fake_acls_gid(handle, &smb_fname_base, &smb_fname->st.st_ex_gid); + } if (ret != 0) { return ret; }