]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_default: support pathref fd's in vfswrap_fremovexattr()
authorRalph Boehme <slow@samba.org>
Tue, 29 Sep 2020 09:10:51 +0000 (11:10 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 09:08:30 +0000 (09:08 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_default.c

index 1ec6f20fd95474adb3bf87d02161cb5dad8465b2..11112fcb962d33c7ec28b50af044e34c3e947bda 100644 (file)
@@ -3623,7 +3623,28 @@ static int vfswrap_removexattr(struct vfs_handle_struct *handle,
 
 static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
 {
-       return fremovexattr(fsp_get_io_fd(fsp), name);
+       int fd = fsp_get_pathref_fd(fsp);
+
+       if (!fsp->fsp_flags.is_pathref) {
+               return fremovexattr(fd, name);
+       }
+
+       if (fsp->fsp_flags.have_proc_fds) {
+               const char *p = NULL;
+               char buf[PATH_MAX];
+
+               p = sys_proc_fd_path(fd, buf, sizeof(buf));
+               if (p == NULL) {
+                       return -1;
+               }
+
+               return removexattr(p, name);
+       }
+
+       /*
+        * This is no longer a handle based call.
+        */
+       return removexattr(fsp->fsp_name->base_name, name);
 }
 
 static int vfswrap_setxattr(struct vfs_handle_struct *handle,