From: Ralph Boehme Date: Thu, 18 Jun 2020 08:54:30 +0000 (+0200) Subject: smbd: don't mess with smb_dname->base_name in call_trans2findfirst() X-Git-Tag: talloc-2.3.2~1064 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c187e2900915b106af15da0dd7a2189877f0acb;p=thirdparty%2Fsamba.git smbd: don't mess with smb_dname->base_name in call_trans2findfirst() Create a fresh name instead. Needed to proper support for path-ref fsps in the future. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 7acde285a90..e2bafc64d74 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2882,14 +2882,21 @@ close_if_end = %d requires_resume_key = %d backup_priv = %d level = 0x%x, max_da } if (p == NULL || p == directory) { + struct smb_filename *old_name = smb_dname; + /* Ensure we don't have a directory name of "". */ - directory = talloc_strdup(talloc_tos(), "."); - if (!directory) { + smb_dname = synthetic_smb_fname(talloc_tos(), + ".", + NULL, + &old_name->st, + old_name->flags, + old_name->twrp); + TALLOC_FREE(old_name); + if (smb_dname == NULL) { reply_nterror(req, NT_STATUS_NO_MEMORY); goto out; } - /* Ensure smb_dname->base_name matches. */ - smb_dname->base_name = directory; + directory = smb_dname->base_name; } DEBUG(5,("dir=%s, mask = %s\n",directory, mask));