]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: return the correct error in can_rename()
authorRalph Boehme <slow@samba.org>
Tue, 19 Dec 2023 12:06:55 +0000 (13:06 +0100)
committerRalph Boehme <slow@samba.org>
Mon, 8 Jan 2024 15:53:36 +0000 (15:53 +0000)
This is what Windows returns for this case.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13688

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/smb2_reply.c

index 729bb21f09b4a24d94c9c0273957bed41e2c5710..f3cc48b7d56b0a0db24f827b2b2a7e8568fc5475 100644 (file)
@@ -1142,6 +1142,11 @@ ssize_t sendfile_short_send(struct smbXsrv_connection *xconn,
 static NTSTATUS can_rename(connection_struct *conn, files_struct *fsp,
                        uint16_t dirtype)
 {
+       if (fsp->fsp_name->twrp != 0) {
+               /* Get the error right, this is what Windows returns. */
+               return NT_STATUS_NOT_SAME_DEVICE;
+       }
+
        if (!CAN_WRITE(conn)) {
                return NT_STATUS_MEDIA_WRITE_PROTECTED;
        }