s3: VFS: zfsacl: Ensure we use a pathref fd, not an io fd, for getting/setting ZFS...
authorJeremy Allison <jra@samba.org>
Mon, 11 Oct 2021 19:26:57 +0000 (12:26 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 12 Oct 2021 18:14:27 +0000 (18:14 +0000)
Don't use path-based calls.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14685

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Oct 12 18:14:27 UTC 2021 on sn-devel-184

source3/modules/vfs_zfsacl.c

index b04c6e560adc5167a62baa6832df29ba15389505..69a1db59249841276faf81512951ec0ff47e343d 100644 (file)
@@ -235,13 +235,12 @@ static bool zfs_process_smbacl(vfs_handle_struct *handle, files_struct *fsp,
        SMB_ASSERT(i == naces);
 
        /* store acl */
-       fd = fsp_get_io_fd(fsp);
-       if (fd != -1) {
-               rv = facl(fd, ACE_SETACL, naces, acebuf);
-       }
-       else {
-               rv = acl(fsp->fsp_name->base_name, ACE_SETACL, naces, acebuf);
+       fd = fsp_get_pathref_fd(fsp);
+       if (fd == -1) {
+               errno = EBADF;
+               return false;
        }
+       rv = facl(fd, ACE_SETACL, naces, acebuf);
        if (rv != 0) {
                if(errno == ENOSYS) {
                        DEBUG(9, ("acl(ACE_SETACL, %s): Operation is not "
@@ -322,11 +321,11 @@ static int fget_zfsacl(TALLOC_CTX *mem_ctx,
        ace_t *acebuf = NULL;
        int fd;
 
-       fd = fsp_get_io_fd(fsp);
+       fd = fsp_get_pathref_fd(fsp);
        if (fd == -1) {
-               return get_zfsacl(mem_ctx, fsp->fsp_name, outbuf);
+               errno = EBADF;
+               return -1;
        }
-
        naces = facl(fd, ACE_GETACLCNT, 0, NULL);
        if (naces == -1) {
                int dbg_level = 10;