Bug 10142 - no write permission + attempted write = wipe file to zero bytes
Summary: no write permission + attempted write = wipe file to zero bytes
Status: NEW
Alias: None
Product: Samba 4.0
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.0.9
Hardware: x64 Linux
: P5 major (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2013-09-16 13:38 UTC by kev (mail address dead)
Modified: 2020-05-04 06:25 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description kev (mail address dead) 2013-09-16 13:38:58 UTC
I have a SerNet Samba 4.0.8 AD DC running on CentOS 6.4 (newdc) 
replicating from a W2K3 DC (olddc).  newdc also has a test share.

I'm experiencing something strange whereby chmod and then an attempted 
file save causes a shared file to become zero bytes (despite the save 
not being blank, and also being denied):

At olddc:

1) open \\newdc\testshare\yay.txt

At newdc:

$ ls -l
total 8
-rw-rw-rw-. 1 me  me  9 Aug 20 10:59 yay.txt
$ cat yay.txt
It works!$ chmod 664 yay.txt

At olddc:

1) add a space to yay.txt and attempt to save.  popup:

Access to \\newdc\testshare\yay.txt was denied.

2) (optional) click OK to close the popup

At newdc*:

$ ls -l
total 4
-rw-rw-r--. 1 kev kev 0 Aug 20 11:12 yay.txt

* Alternatively, without touching newdc, I can shift focus from the 
TextPad window and back to it, and it will say that the file has 
changed.  If I choose to reload it, it's now blank.

Isn't this a bug?  I would expect a write that fails due to lack of 
write permissions to not actually affect the content of the file.

I have SELinux disabled.

I just experienced this in a similar fashion after upgrading to Sernet Samba 4.0.9.  On OLDDC, I made a change to \\olddc\netlogon\logon.cmd , then in Windows Explorer, attempted to copy that file and past it at \\newdc\netlogon\logon.cmd.  It gave me an access denied error, and then overwrote my logon.cmd with a zero-byte file!  I then took ownership of the netlogon directory on newdc (still from the Windows 2k3 UI) and I was able to paste the file correctly, whew.

It's possible I have something misconfigured, but IMO one shouldn't be able to configure things this way (i.e., when would this ever be a desirable result?)

Anyway my configuration for these shares is:

        path = /var/lib/samba/sysvol/mydom.lan/scripts
        read only = No

        path = /home/srv/samba-test-share
        read only = No
        force create mode = 0777
        force directory mode = 0777

Comment 1 Björn Jacke 2020-05-04 06:25:01 UTC
is this still an issue with the latest releases? And is this just an issue on a DC or also on a member server?