[PATCH] use current working directory instead of share path in cephwrap_realpath

Jeremy Allison jra at samba.org
Fri Apr 26 20:41:04 UTC 2019


On Fri, Apr 26, 2019 at 10:36:24PM +0200, Robert Sander via samba-technical wrote:
> Hi,
> 
> reading symbolic links from a CephFS via vfs_ceph does not always work.
> It looks like the CWD instead of the share path should be used to
> construct the real path.

Yes, that's completely correct. Thanks a *LOT* for catching
that. I'll log a bug to track.

We now change to $cwd to prevent symlink races
so handle->conn->connectpath isn't always the
directory we're in anymore.

> Attached is a patch that changes this. Please review.

RB+. Can I get a second Team reviewer please ?

Jeremy.

> Kindest Regards
> -- 
> Robert Sander
> Heinlein Support GmbH
> Schwedter Str. 8/9b, 10119 Berlin
> 
> http://www.heinlein-support.de
> 
> Tel: 030 / 405051-43
> Fax: 030 / 405051-19
> 
> Zwangsangaben lt. §35a GmbHG:
> HRB 93818 B / Amtsgericht Berlin-Charlottenburg,
> Geschäftsführer: Peer Heinlein -- Sitz: Berlin

> From 8e5c2d08781ce638f261a866f1098675d8d3331d Mon Sep 17 00:00:00 2001
> From: Robert Sander <r.sander at heinlein-support.de>
> Date: Fri, 26 Apr 2019 17:52:58 +0200
> Subject: [PATCH] use current working directory instead of share path
> 
> ---
>  source3/modules/vfs_ceph.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
> index cf45fb4c919..57de8bc891a 100644
> --- a/source3/modules/vfs_ceph.c
> +++ b/source3/modules/vfs_ceph.c
> @@ -1206,14 +1206,14 @@ static struct smb_filename *cephwrap_realpath(struct vfs_handle_struct *handle,
>  	} else if ((len >= 2) && (path[0] == '.') && (path[1] == '/')) {
>  		if (len == 2) {
>  			r = asprintf(&result, "%s",
> -					handle->conn->connectpath);
> +					handle->conn->cwd_fname->base_name);
>  		} else {
>  			r = asprintf(&result, "%s/%s",
> -					handle->conn->connectpath, &path[2]);
> +					handle->conn->cwd_fname->base_name, &path[2]);
>  		}
>  	} else {
>  		r = asprintf(&result, "%s/%s",
> -				handle->conn->connectpath, path);
> +				handle->conn->cwd_fname->base_name, path);
>  	}
>  
>  	if (r < 0) {
> -- 
> 2.17.1
> 







More information about the samba-technical mailing list