Doing directory scans on the path components is not going to change this, so
give up early. No change in behaviour, as we would just fail later in
get_real_filename() otherwise.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 22 21:08:39 UTC 2020 on sn-devel-184
/* Stat failed - ensure we don't use it. */
SET_STAT_INVALID(smb_fname->st);
+ if (errno == EACCES) {
+ /*
+ * Early exit on access denied. Walking
+ * the path won't fix that.
+ */
+ DBG_DEBUG("stat [%s]: %s\n",
+ smb_fname_str_dbg(smb_fname),
+ strerror(errno));
+ status = NT_STATUS_ACCESS_DENIED;
+ goto fail;
+ }
+
if (errno == ENOENT) {
/* Optimization when creating a new file - only
the last component doesn't exist.