summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2022-03-09 12:58:40 +0100
committerJule Anger <janger@samba.org>2022-07-11 10:27:17 +0000
commit54ad51cd3cc87bc77789821592b50aa1c3d0133c (patch)
tree56b920091502d26b7e18ae7847aeab780053ba2c
parentcce25171f7e24ce39693677c9edcdc584f8d9db4 (diff)
downloadsamba-54ad51cd3cc87bc77789821592b50aa1c3d0133c.tar.gz
smbd: Make non_widelink_open() robust for non-cwd dirfsp
If you pass in dirfsp!=conn->cwd_fsp and a stream fsp, we don't chdir to the parent pathname, and thus we also don't overwrite fsp->base_fsp. fsp->base_fsp!=NULL is thus the wrong condition to restore the original base fsp name: If we open a stream with a non-cwd_fsp dirfsp, we would overwrite fsp->base_fsp->fsp_name with NULL. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15105 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 280e9191cbf8a766e69ab138450f2beccbedd879)
-rw-r--r--source3/smbd/open.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index a94b85f8f20..0fdbb1a9fa3 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -854,7 +854,8 @@ static NTSTATUS non_widelink_open(const struct files_struct *dirfsp,
out:
fsp->fsp_name = orig_fsp_name;
- if (fsp->base_fsp != NULL) {
+
+ if (orig_base_fsp_name != NULL) {
/* Save off the temporary name. */
struct smb_filename *base_smb_fname_rel =
fsp->base_fsp->fsp_name;