[PATCH] Fix failure to update dirpath

Jeremy Allison jra at samba.org
Tue Aug 21 01:35:16 UTC 2018

On Mon, Aug 20, 2018 at 06:02:31PM -0700, Jeremy Allison via samba-technical wrote:
> Hang on a minute. I've been looking really closely
> now at the *callers* of check_parent_exists() and
> many of them depend on *dirpath == '\0' in the
> case where smb_fname->base_name doesn't contain
> a component containing '/' characters.
> I think my fix, although it might work, will affect
> other paths. Let me look at this more closely
> tomorrow. I'm withdrawing this for now.

OK, my fix was way too invasive for the fix that
you need to make Gluster work again for that bug.

The problem is that the code that constructs
the complete pathname depends on *dirpath == '\0'
to avoid adding a "./" prefix to every constructed
pathname. My patch would cause all of those
code paths to change to the full/component/path
cases, which is not what we want. That's going
to affect what goes into the stat-cache as well
as many other things I'll have to go through
carefully to find.

This is a set of code-paths that we might clean
up in the future, but not for this specific bug
I think.

Can you test the following change instead ?

Much simpler and I think it will fix the immediate
Gluster problem (it's the same change that already
exists inside get_real_filename_full_scan() so
I think this is something we already ran across


-------------- next part --------------
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 9e15af1..41c1710 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 = ".";
+	}
 	mangled = mangle_is_mangled(name, conn->params);
 	if (mangled) {

More information about the samba-technical mailing list