[PATCH] Fix Gluster bug - unable to create file/directory under root of the share due to empty dirpath during get_real_filename()

Michael Adam obnox at samba.org
Wed Aug 22 14:37:16 UTC 2018


On 2018-08-21 at 12:52 -0700, Jeremy Allison via samba-technical wrote:
> As confirmed by Anoop, this is a much simpler
> and direct patch that adds the protection already
> in get_real_filename_full_scan() to get_real_filename().
> 
> Fixes an error when used with Glusterfs.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13585
> 
> Please review and push if happy !
> 
> Cheers,
> 
> 	Jeremy.

> From 420477c80eb678f593e8c1b9f785cb94da9f5942 Mon Sep 17 00:00:00 2001
> From: Jeremy Allison <jra at samba.org>
> Date: Tue, 21 Aug 2018 12:05:34 -0700
> Subject: [PATCH] s3: smbd: Ensure get_real_filename() copes with empty
>  pathnames.
> 
> Needed for vfs_glusterfs, as Gluster requires "." not '\0'.
> 
> Based on a fix from Anoop C S <anoopcs at redhat.com>
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13585
> 
> Signed-off-by: Jeremy Allison <jra at samba.org>
> ---
>  source3/smbd/filename.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
> index 9e15af1916d..41c1710351e 100644
> --- a/source3/smbd/filename.c
> +++ b/source3/smbd/filename.c
> @@ -1443,6 +1443,11 @@ int get_real_filename(connection_struct *conn, const char *path,
>  	int ret;
>  	bool mangled;
>  
> +	/* handle null paths */
> +	if ((path == NULL) || (*path == 0)) {
> +		path = ".";
> +	}

Jeremy,

As detailed in the original thread, I think this
patch is kind of emphasising the arbitrariness of
the current check_parent_exists() function and
the other, bigger patch is IMHO the conceptually
much better patch. Can we reconsider that one?

Thanks - Michael

> +
>  	mangled = mangle_is_mangled(name, conn->params);
>  
>  	if (mangled) {
> -- 
> 2.18.0.865.gffc8e1a3cd6-goog
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180822/4c5f84ec/signature.sig>


More information about the samba-technical mailing list