]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: don't mess with smb_dname->base_name in call_trans2findfirst()
authorRalph Boehme <slow@samba.org>
Thu, 18 Jun 2020 08:54:30 +0000 (10:54 +0200)
committerJeremy Allison <jra@samba.org>
Sat, 18 Jul 2020 05:58:41 +0000 (05:58 +0000)
Create a fresh name instead. Needed to proper support for path-ref fsps in the
future.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/trans2.c

index 7acde285a90d23f6aa94e1014e9888816e840e3d..e2bafc64d7493a0c61f9b605209857034a095cb2 100644 (file)
@@ -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));