diff options
author | Ralph Boehme <slow@samba.org> | 2020-10-01 15:21:45 +0200 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2020-12-16 09:08:30 +0000 |
commit | c9889c194aa61c20ff91baa14ef4f2d37d292e86 (patch) | |
tree | 208d03aa033a73647af8b8468c1163f5fd4a81a7 /source3/modules/vfs_posixacl.c | |
parent | b2e6d7b00bc01523631ebbcebaa7f8dbbd626bd0 (diff) | |
download | samba-c9889c194aa61c20ff91baa14ef4f2d37d292e86.tar.gz |
vfs_posixacl: support pathref fd's in posixacl_sys_acl_set_fd()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/modules/vfs_posixacl.c')
-rw-r--r-- | source3/modules/vfs_posixacl.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/source3/modules/vfs_posixacl.c b/source3/modules/vfs_posixacl.c index 2ab2cc026be..cca4dd22b60 100644 --- a/source3/modules/vfs_posixacl.c +++ b/source3/modules/vfs_posixacl.c @@ -141,10 +141,32 @@ int posixacl_sys_acl_set_fd(vfs_handle_struct *handle, { int res; acl_t acl = smb_acl_to_posix(theacl); + int fd = fsp_get_pathref_fd(fsp); + if (acl == NULL) { return -1; } - res = acl_set_fd(fsp_get_io_fd(fsp), acl); + + if (!fsp->fsp_flags.is_pathref) { + res = acl_set_fd(fd, acl); + } else if (fsp->fsp_flags.have_proc_fds) { + const char *proc_fd_path = NULL; + char buf[PATH_MAX]; + + proc_fd_path = sys_proc_fd_path(fd, buf, sizeof(buf)); + if (proc_fd_path == NULL) { + return -1; + } + res = acl_set_file(proc_fd_path, ACL_TYPE_ACCESS, acl); + } else { + /* + * This is no longer a handle based call. + */ + res = acl_set_file(fsp->fsp_name->base_name, + ACL_TYPE_ACCESS, + acl); + } + acl_free(acl); return res; } |