]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Align [smb|smb2]_file_link_information code
authorVolker Lendecke <vl@samba.org>
Mon, 15 Sep 2025 18:35:46 +0000 (11:35 -0700)
committerRalph Boehme <slow@samba.org>
Tue, 21 Oct 2025 17:33:29 +0000 (17:33 +0000)
The next patch will merge them into one function. Make it obvious in a separate
patch that they are the same except for parsing the input buffer.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/smb2_trans2.c

index 1801bca00fdbfc6f255515c77acfd03f9f9ece11..1d0580c0283dacea32f4d46b86040f1e11df7b3c 100644 (file)
@@ -4468,16 +4468,16 @@ static NTSTATUS smb2_file_link_information(connection_struct *conn,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       /* SMB2 hardlink paths are never DFS. */
-       req->flags2 &= ~FLAGS2_DFS_PATHNAMES;
-       ucf_flags &= ~UCF_DFS_PATHNAME;
-
        status = check_path_syntax(newname,
                        fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
 
+       /* hardlink paths are never DFS. */
+       req->flags2 &= ~FLAGS2_DFS_PATHNAMES;
+       ucf_flags &= ~UCF_DFS_PATHNAME;
+
        DBG_DEBUG("got name |%s|\n", newname);
 
        status = filename_convert_dirfsp_rel(ctx,
@@ -4573,14 +4573,16 @@ static NTSTATUS smb_file_link_information(connection_struct *conn,
                return status;
        }
 
-       DBG_DEBUG("got name |%s|\n", newname);
-
        if (ucf_flags & UCF_GMT_PATHNAME) {
                extract_snapshot_token(newname, &dst_twrp);
        }
+
        /* hardlink paths are never DFS. */
+       req->flags2 &= ~FLAGS2_DFS_PATHNAMES;
        ucf_flags &= ~UCF_DFS_PATHNAME;
 
+       DBG_DEBUG("got name |%s|\n", newname);
+
        status = filename_convert_dirfsp_rel(ctx,
                                             conn,
                                             conn->cwd_fsp,