]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Convert smb_file_link_information() to use filename_convert_dirfsp().
authorJeremy Allison <jra@samba.org>
Thu, 28 Jul 2022 19:32:07 +0000 (12:32 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 2 Aug 2022 19:49:32 +0000 (19:49 +0000)
One less use of filename_convert().

Later we should optimize this by passing in
the src_dirfsp from the caller.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/smb2_trans2.c

index f2d6e59da3432bd6f16de39db7b4fc826db21cf1..fb1b07ee58870e5abd8d7703830626d39efcd622 100644 (file)
@@ -5068,9 +5068,11 @@ static NTSTATUS smb_file_link_information(connection_struct *conn,
        bool overwrite;
        uint32_t len;
        char *newname = NULL;
+       struct files_struct *dst_dirfsp = NULL;
        struct smb_filename *smb_fname_dst = NULL;
        NTSTATUS status = NT_STATUS_OK;
        uint32_t ucf_flags = ucf_flags_from_smb_request(req);
+       NTTIME dst_twrp = 0;
        TALLOC_CTX *ctx = talloc_tos();
 
        if (!fsp) {
@@ -5115,12 +5117,16 @@ static NTSTATUS smb_file_link_information(connection_struct *conn,
        DEBUG(10,("smb_file_link_information: got name |%s|\n",
                                newname));
 
-       status = filename_convert(ctx,
-                               conn,
-                               newname,
-                               ucf_flags,
-                               0,
-                               &smb_fname_dst);
+       if (ucf_flags & UCF_GMT_PATHNAME) {
+               extract_snapshot_token(newname, &dst_twrp);
+       }
+       status = filename_convert_dirfsp(ctx,
+                                        conn,
+                                        newname,
+                                        ucf_flags,
+                                        dst_twrp,
+                                        &dst_dirfsp,
+                                        &smb_fname_dst);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -5140,7 +5146,7 @@ static NTSTATUS smb_file_link_information(connection_struct *conn,
                                overwrite,
                                NULL, /* src_dirfsp */
                                fsp->fsp_name,
-                               NULL, /* dst_dirfsp */
+                               dst_dirfsp, /* dst_dirfsp */
                                smb_fname_dst);
 
        TALLOC_FREE(smb_fname_dst);