From: Ralph Boehme Date: Thu, 1 Oct 2020 13:20:56 +0000 (+0200) Subject: vfs_posixacl: support pathref fd's in posixacl_sys_acl_get_fd() X-Git-Tag: samba-4.14.0rc1~392 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b2e6d7b00bc01523631ebbcebaa7f8dbbd626bd0;p=thirdparty%2Fsamba.git vfs_posixacl: support pathref fd's in posixacl_sys_acl_get_fd() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_posixacl.c b/source3/modules/vfs_posixacl.c index 219acc6bd4d..2ab2cc026be 100644 --- a/source3/modules/vfs_posixacl.c +++ b/source3/modules/vfs_posixacl.c @@ -69,8 +69,27 @@ SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, TALLOC_CTX *mem_ctx) { struct smb_acl_t *result; - acl_t acl = acl_get_fd(fsp_get_io_fd(fsp)); + acl_t acl = NULL; + if (!fsp->fsp_flags.is_pathref) { + acl = acl_get_fd(fsp_get_io_fd(fsp)); + } else if (fsp->fsp_flags.have_proc_fds) { + int fd = fsp_get_pathref_fd(fsp); + 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 NULL; + } + + acl = acl_get_file(proc_fd_path, ACL_TYPE_ACCESS); + } else { + /* + * This is no longer a handle based call. + */ + acl = acl_get_file(fsp->fsp_name->base_name, ACL_TYPE_ACCESS); + } if (acl == NULL) { return NULL; }