Created attachment 17068 [details] patch-rename-operation-errno When using SMBC_rename_ctx (source3\libsmb\libsmb_dir.c) to overwrite an already existing file or folder, the error code is not set properly. Looking at the source code, one can track it down to the fact that the cli->raw_status is not set. Therefore the conversion from NT error to UNIX error doesn't work properly and you end with a situation where the rename fails but the error code is equal to zero. I am attaching a proposal for a patch against version 4.15.1. Server runs NetApp.
Patch isn't correct (it assigns "state" to an NTSTATUS value), but gives me the correct idea. We need a regression test for this first though. I'll take a look at that later this week.
Patch is under ci test at: https://gitlab.com/samba-team/devel/samba/-/pipelines/462101182
https://gitlab.com/samba-team/samba/-/merge_requests/2359
This bug was referenced in samba master: 0ecc58858360bcc0181a02e52ada3e8327f97c5b ca60f6350d566b7ecc822bcbb44fb65a1d150bbe
Created attachment 17142 [details] git-am fix for 4.16.rcNext., 4.15.next, 4.14.next. Cherry-picked from master. Applies cleanly to 4.16.rcNext, 4.15.next, 4.14.next.
Reassigning to Jule for inclusion in 4.16, 4.15 and 4.14.
Pushed to autobuild-v4-{16,15,14}-test.
This bug was referenced in samba v4-15-test: 641271eaa076cfbebdc22e472e57a088ef88a298 bbb7aacf4909d6cffb08b461e094cb8641ff9d39
This bug was referenced in samba v4-16-test: 5c55418c25eb18d44416f486d1468ca6ccce0ab7 64aea70f9f80acec2ba4f5da44e413f2f91c75c0
This bug was referenced in samba v4-14-test: d775a15a34620da8b2cbe3c61621bd5cfe763f16 9a4c688c2e7dfe0c2ca1bdce4e7fa724e05b2f81
This bug was referenced in samba v4-16-stable (Release samba-4.16.0rc3): 5c55418c25eb18d44416f486d1468ca6ccce0ab7 64aea70f9f80acec2ba4f5da44e413f2f91c75c0
This bug was referenced in samba v4-15-stable (Release samba-4.15.6): 641271eaa076cfbebdc22e472e57a088ef88a298 bbb7aacf4909d6cffb08b461e094cb8641ff9d39
This bug was referenced in samba v4-14-stable (Release samba-4.14.13): d775a15a34620da8b2cbe3c61621bd5cfe763f16 9a4c688c2e7dfe0c2ca1bdce4e7fa724e05b2f81