vfs_fruit: Replace closedir() by SMB_VFS_CLOSEDIR
authorAnoop C S <anoopcs@redhat.com>
Fri, 13 Oct 2017 15:08:31 +0000 (20:38 +0530)
committerGünther Deschner <gd@samba.org>
Mon, 16 Oct 2017 17:56:55 +0000 (19:56 +0200)
Pointer to directory 'dh' inside fruit_rmdir() is obtained using
SMB_VFS_OPENDIR. But this handle is closed directly by invoking
closedir() rather than SMB_VFS_CLOSEDIR. This will result in a
smbd crash if this handle was not obtained from local file system.
Therefore use SMB_VFS_CLOSEDIR corresponding to SMB_VFS_OPENDIR
to correctly close the directory handle.

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

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Mon Oct 16 19:56:55 CEST 2017 on sn-devel-144

source3/modules/vfs_fruit.c

index 27719806c6d93e64d8e7f40326d3fb4593a08592..b0dd0f062bd16c9b1f044d90db09eb72abe10633 100644 (file)
@@ -3785,7 +3785,7 @@ static int fruit_rmdir(struct vfs_handle_struct *handle,
 
 exit_rmdir:
        if (dh) {
-               closedir(dh);
+               SMB_VFS_CLOSEDIR(handle->conn, dh);
        }
        return SMB_VFS_NEXT_RMDIR(handle, smb_fname);
 }