The branch, master has been updated
       via  f44918e6c83 s3: VFS: default: Add proc_fd's fallback for 
vfswrap_fchown().
      from  767287920aa selftest/gdb_backtrace: remove duplicate assignment.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f44918e6c83c89936156eb24c982a897c9c45f61
Author: Jeremy Allison <j...@samba.org>
Date:   Wed Jun 9 15:57:38 2021 -0700

    s3: VFS: default: Add proc_fd's fallback for vfswrap_fchown().
    
    https://bugzilla.samba.org/show_bug.cgi?id=14734
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power <npo...@samba.org>
    
    Autobuild-User(master): Noel Power <npo...@samba.org>
    Autobuild-Date(master): Thu Jun 10 09:16:22 UTC 2021 on sn-devel-184

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/vfs_default.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 187b68a78cf..79531f83483 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2514,7 +2514,31 @@ static int vfswrap_fchown(vfs_handle_struct *handle, 
files_struct *fsp, uid_t ui
        int result;
 
        START_PROFILE(syscall_fchown);
-       result = fchown(fsp_get_io_fd(fsp), uid, gid);
+       if (!fsp->fsp_flags.is_pathref) {
+               result = fchown(fsp_get_io_fd(fsp), uid, gid);
+               END_PROFILE(syscall_fchown);
+               return result;
+       }
+
+       if (fsp->fsp_flags.have_proc_fds) {
+               int fd = fsp_get_pathref_fd(fsp);
+               const char *p = NULL;
+               char buf[PATH_MAX];
+
+               p = sys_proc_fd_path(fd, buf, sizeof(buf));
+               if (p != NULL) {
+                       result = chown(p, uid, gid);
+               } else {
+                       result = -1;
+               }
+               END_PROFILE(syscall_fchown);
+               return result;
+       }
+
+       /*
+        * This is no longer a handle based call.
+        */
+       result = chown(fsp->fsp_name->base_name, uid, gid);
        END_PROFILE(syscall_fchown);
        return result;
 #else


-- 
Samba Shared Repository

Reply via email to