From: Richard Sharpe Date: Mon, 17 Sep 2018 22:38:06 +0000 (-0700) Subject: s3: Don't copy back the stat struct from stat_cache_lookup if we did not get a hit... X-Git-Tag: tdb-1.3.17~1527 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48ad1db3c5b513863a8f7868d2a92ebb8df2a27e;p=thirdparty%2Fsamba.git s3: Don't copy back the stat struct from stat_cache_lookup if we did not get a hit on the full path. Signed-off-by: Richard Sharpe Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c index 27f9dec48f7..5162ec06ea9 100644 --- a/source3/smbd/statcache.c +++ b/source3/smbd/statcache.c @@ -261,10 +261,7 @@ bool stat_cache_lookup(connection_struct *conn, * Count the number of times we have done this, we'll * need it when reconstructing the string. */ - - if (sizechanged) { - num_components++; - } + num_components++; if ((*chk_name == '\0') || ISDOT(chk_name) || ISDOTDOT(chk_name)) { @@ -301,7 +298,12 @@ bool stat_cache_lookup(connection_struct *conn, TALLOC_FREE(translated_path); return False; } - *pst = smb_fname.st; + /* + * Only copy the stat struct back if we actually hit the full path + */ + if (num_components == 0) { + *pst = smb_fname.st; + } if (!sizechanged) { memcpy(*pp_name, translated_path,