]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify smb2_parse_file_rename_information()
authorVolker Lendecke <vl@samba.org>
Fri, 26 Sep 2025 08:40:45 +0000 (10:40 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 21 Oct 2025 18:35:59 +0000 (18:35 +0000)
We don't really need "fsp" and "smb_fname_src" arguments anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Oct 21 18:35:59 UTC 2025 on atb-devel-224

source3/smbd/proto.h
source3/smbd/smb2_setinfo.c
source3/smbd/smb2_trans2.c

index f764b30b6439562c3097bca04cb374f345ecd93a..5e7677d347ffa73b864952a0c4fed7b584fa8a98 100644 (file)
@@ -1142,8 +1142,7 @@ NTSTATUS smb2_parse_file_rename_information(TALLOC_CTX *ctx,
                                            struct smb_request *req,
                                            const char *pdata,
                                            int total_data,
-                                           files_struct *fsp,
-                                           struct smb_filename *smb_fname_src,
+                                           bool posix,
                                            char **_newname,
                                            bool *overwrite);
 
index f66ad34baa9315391a49ca05fceee977770f5790..97abdf9ad1b3750fac5d77ac8114e593cef03443 100644 (file)
@@ -412,15 +412,15 @@ static NTSTATUS smb2_parse_file_rename_information_dst(
        uint32_t ucf_flags = ucf_flags_from_smb_request(req);
        NTSTATUS status;
 
-       status = smb2_parse_file_rename_information(mem_ctx,
-                                                   conn,
-                                                   req,
-                                                   pdata,
-                                                   total_data,
-                                                   fsp,
-                                                   smb_fname_src,
-                                                   &newname,
-                                                   &overwrite);
+       status = smb2_parse_file_rename_information(
+               mem_ctx,
+               conn,
+               req,
+               pdata,
+               total_data,
+               fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH,
+               &newname,
+               &overwrite);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
index e2e7f3af9df5bfde17913c929405d0d812c6001d..367c3a473b481508c22dc468996d90e47884b55a 100644 (file)
@@ -4242,8 +4242,7 @@ NTSTATUS smb2_parse_file_rename_information(TALLOC_CTX *ctx,
                                            struct smb_request *req,
                                            const char *pdata,
                                            int total_data,
-                                           files_struct *fsp,
-                                           struct smb_filename *smb_fname_src,
+                                           bool posix,
                                            char **_newname,
                                            bool *_overwrite)
 {
@@ -4252,10 +4251,6 @@ NTSTATUS smb2_parse_file_rename_information(TALLOC_CTX *ctx,
        uint32_t len;
        NTSTATUS status;
 
-       if (!fsp) {
-               return NT_STATUS_INVALID_HANDLE;
-       }
-
        if (total_data < 20) {
                return NT_STATUS_INVALID_PARAMETER;
        }
@@ -4279,8 +4274,7 @@ NTSTATUS smb2_parse_file_rename_information(TALLOC_CTX *ctx,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       status = check_path_syntax(newname,
-                       fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH);
+       status = check_path_syntax(newname, posix);
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(newname);
                return status;
@@ -4308,15 +4302,15 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
        NTSTATUS status = NT_STATUS_OK;
        TALLOC_CTX *ctx = talloc_tos();
 
-       status = smb2_parse_file_rename_information(ctx,
-                                                   conn,
-                                                   req,
-                                                   pdata,
-                                                   total_data,
-                                                   fsp,
-                                                   smb_fname_src,
-                                                   &newname,
-                                                   &overwrite);
+       status = smb2_parse_file_rename_information(
+               ctx,
+               conn,
+               req,
+               pdata,
+               total_data,
+               fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH,
+               &newname,
+               &overwrite);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }