]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: use real dirfsp for SMB_VFS_UNLINKAT() in create_msdfs_link()
authorRalph Boehme <slow@samba.org>
Fri, 22 Jan 2021 13:47:13 +0000 (14:47 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 28 Jan 2021 08:11:49 +0000 (08:11 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/msdfs.c

index dc07727f007b52fe415f5916fd4e51d083fa055e..aa88e8fd417fbd6644107d8484b97915ef58269f 100644 (file)
@@ -1380,6 +1380,8 @@ bool create_msdfs_link(const struct junction_map *jucn,
        char *path = NULL;
        connection_struct *conn;
        struct smb_filename *smb_fname = NULL;
+       struct smb_filename *parent_fname = NULL;
+       struct smb_filename *at_fname = NULL;
        bool ok;
        NTSTATUS status;
        bool ret = false;
@@ -1409,6 +1411,15 @@ bool create_msdfs_link(const struct junction_map *jucn,
                goto out;
        }
 
+       status = parent_pathref(frame,
+                               conn->cwd_fsp,
+                               smb_fname,
+                               &parent_fname,
+                               &at_fname);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto out;
+       }
+
        status = SMB_VFS_CREATE_DFS_PATHAT(conn,
                                conn->cwd_fsp,
                                smb_fname,
@@ -1417,8 +1428,8 @@ bool create_msdfs_link(const struct junction_map *jucn,
        if (!NT_STATUS_IS_OK(status)) {
                if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
                        int retval = SMB_VFS_UNLINKAT(conn,
-                                               conn->cwd_fsp,
-                                               smb_fname,
+                                               parent_fname->fsp,
+                                               at_fname,
                                                0);
                        if (retval != 0) {
                                goto out;