]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: fake_acls: In fake_acls_stat() - if we have a pathref fsp, use it.
authorJeremy Allison <jra@samba.org>
Wed, 23 Jun 2021 02:10:37 +0000 (19:10 -0700)
committerRalph Boehme <slow@samba.org>
Fri, 25 Jun 2021 15:53:31 +0000 (15:53 +0000)
We will add a pathref open for the case where we don't next.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_fake_acls.c

index 4d1211a064983a1ae2cabea32c817086c32163e4..c675479cea717ae4cf3210dc49eee2fa7a92ccbd 100644 (file)
@@ -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;
                }