[PATCH] Fix a smbd crash from vfs_fruit

Jeremy Allison jra at samba.org
Fri Oct 13 16:09:33 UTC 2017


On Fri, Oct 13, 2017 at 09:03:53PM +0530, Anoop C S via samba-technical wrote:
> Hi,
> 
> Please see the attached patch which fixes a smbd crash while deleting directory from Mac OS terminal
> client with fruit module.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13086
> 
> Reviews are appreciated.

RB+. Obvious goodness :-). Can I get a second Team reviewer ?

> From c4342b48a01e5068c87cfc85d16af05fe37df3f9 Mon Sep 17 00:00:00 2001
> From: Anoop C S <anoopcs at redhat.com>
> Date: Fri, 13 Oct 2017 20:38:31 +0530
> Subject: [PATCH] vfs_fruit: Replace closedir() by SMB_VFS_CLOSEDIR
> 
> 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 at redhat.com>
> ---
>  source3/modules/vfs_fruit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
> index 5c9e680d299..0526edecfe0 100644
> --- a/source3/modules/vfs_fruit.c
> +++ b/source3/modules/vfs_fruit.c
> @@ -3456,7 +3456,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);
>  }
> -- 
> 2.13.6
> 




More information about the samba-technical mailing list