[Samba] samba allows rename to a locked file (from linux cifs mount)

Jeremy Allison jra at samba.org
Sun Mar 17 03:22:15 UTC 2024


On Sat, Mar 16, 2024 at 10:08:34PM +0300, Michael Tokarev via samba wrote:
>
>Exactly, just a plain file.  For example, an executable (.exe) file
>which is currently running by some windows client, like this
>(from smbstatus):
>
>Locked files:
>Pid          User(ID)   DenyMode   Access      R/W        Oplock           SharePath   Name   Time
>--------------------------------------------------------------------------------------------------
>926452       122        DENY_WRITE 0x1000a1    RDONLY     LEASE(RWH)       /share/files   .rel/ekis1/plan/oraprjplan.exe   Sat Mar 16 21:28:10 2024
>
>From any another windows machine I can't rename or remove this
>file, it says "the file is in use".  While on linux when this
>share is mounted using cifs, it removes or renames without any
>issues, and this is causing the windows machine to do Bad Things
>(exactly as if the file has been replaced on the samba server
>behind samba's back).
>
>Mostly this is about writing a new temporary file and renaming
>it to final name (oraprjplan.exe in this case), or just removing -
>either works without an issue.
>
>smbclient does it a bit different, looks like smbclient's delete just
>"marks" the file to be deleted in this case (smbclient doesn't let to
>rename-override, "rename" fails due to destination already exists).
>
>I probably should enable trace on the samba server and see why it
>allows doing things for linux client but denies the same action for
>a windows client.

Wireshark trace on the server from the Linux client as well please. That will tell
us *exactly* what operations it's doing.



More information about the samba mailing list