From b838378024966ac75119d6426380178f8c482a16 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 19 Dec 2023 13:06:55 +0100 Subject: [PATCH] smbd: return the correct error in can_rename() This is what Windows returns for this case. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13688 Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher (cherry picked from commit 276c5bd851ab6ab818a49d9c47f6b96de8024778) --- source3/smbd/smb2_reply.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source3/smbd/smb2_reply.c b/source3/smbd/smb2_reply.c index dfcd05d2cae..a7c63c0df58 100644 --- a/source3/smbd/smb2_reply.c +++ b/source3/smbd/smb2_reply.c @@ -1140,6 +1140,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; } -- 2.34.1