1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3/modules: fchmod: fallback to path based chmod if pathref

Signed-off-by: Noel Power <noel.power@suse.com>
Signed-off-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Ralph Boehme 2021-04-09 14:58:34 +02:00 committed by Noel Power
parent f923d1f474
commit 6ad10836d6

View File

@ -2426,7 +2426,31 @@ static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t m
START_PROFILE(syscall_fchmod);
result = fchmod(fsp_get_io_fd(fsp), mode);
if (!fsp->fsp_flags.is_pathref) {
result = fchmod(fsp_get_io_fd(fsp), mode);
END_PROFILE(syscall_fchmod);
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 = chmod(p, mode);
} else {
result = -1;
}
END_PROFILE(syscall_fchmod);
return result;
}
/*
* This is no longer a handle based call.
*/
result = chmod(fsp->fsp_name->base_name, mode);
END_PROFILE(syscall_fchmod);
return result;