From 3d3d01cda8d3a6d0d18d1b808aa9414e71d56062 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 12 Jan 2023 11:20:08 -0800 Subject: [PATCH] s3: smbd: Tweak openat_pathref_dirfsp_nosymlink() to NULL out fsp->fsp_name after calling fd_close() on intermediate directories, rather than before. vfs_virusfilter expects a non-NULL fsp->fsp_name to use for printing debugs (it always indirects fsp->fsp_name). vfs_fruit also does the same, so would also crash in fruit_close() with 'debug level = 10' and vfs_default:VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS = no set (we don't test with that which is why we haven't noticed this before). Remove knownfail. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15283 Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Fri Jan 13 08:33:47 UTC 2023 on sn-devel-184 --- selftest/knownfail.d/virusscanner | 1 - source3/smbd/files.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 selftest/knownfail.d/virusscanner diff --git a/selftest/knownfail.d/virusscanner b/selftest/knownfail.d/virusscanner deleted file mode 100644 index 9bcaae7b4d1..00000000000 --- a/selftest/knownfail.d/virusscanner +++ /dev/null @@ -1 +0,0 @@ -^samba3.blackbox.virus_scanner.check_infected_read\(fileserver:local\) diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 87684b1984d..792e9424bdc 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -1058,9 +1058,9 @@ next: } if (dirfsp != conn->cwd_fsp) { - dirfsp->fsp_name = NULL; SMB_ASSERT(fsp_get_pathref_fd(dirfsp) != -1); fd_close(dirfsp); + dirfsp->fsp_name = NULL; file_free(NULL, dirfsp); dirfsp = NULL; } @@ -1122,9 +1122,9 @@ fail: } if ((dirfsp != NULL) && (dirfsp != conn->cwd_fsp)) { - dirfsp->fsp_name = NULL; SMB_ASSERT(fsp_get_pathref_fd(dirfsp) != -1); fd_close(dirfsp); + dirfsp->fsp_name = NULL; file_free(NULL, dirfsp); dirfsp = NULL; } -- 2.11.4.GIT