Bug 2646 - file open over cifs results in "access denied", but the file is truncated ?!?
Summary: file open over cifs results in "access denied", but the file is truncated ?!?
Status: RESOLVED WORKSFORME
Alias: None
Product: CifsVFS
Classification: Unclassified
Component: kernel fs (show other bugs)
Version: 2.6
Hardware: All Linux
: P3 normal
Target Milestone: ---
Assignee: Steve French
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-25 04:42 UTC by Olivier Sessink
Modified: 2009-09-25 15:28 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Sessink 2005-04-25 04:42:20 UTC
On the server 'pkedu' (Debian Woody, samba 2.2.3a-15), I have a file which I am
not the owner of, but it is group writable, and my account is in that specific
group.

olivier@pkedu:/home/pkedu/olivier/bftest$ ls -l
-rw-rw-r--    1 tinri    pkedu           0 Apr 25 12:03 testfile.txt
olivier@pkedu:/home/pkedu/olivier/bftest$ ls -l ../
drwxrwsr-x    2 tinri    pkedu        4096 Apr 25 12:01 bftest

*note*: the directory has the "set group id on execution" bit set!

olivier@pkedu:/home/pkedu/olivier/bftest$ id
uid=1000(olivier) gid=1000(olivier) groups=1000(olivier),104(pkedu)

The samba server is configured:

[pkedu]
   path = /home/pkedu
   public = no
   create mask = 0664
   writable = yes
   valid users = @pkedu
   force group = +pkedu
   directory mask = 0775

I mount it on my desktop machine 'olidell' with these options:

mount.cifs //pkedu/pkedu ~olivier/pkedu -o
ip=xxx.xxx.xxx.xxx,username=olivier,uid=1000,gid=1000,file_mode=0600,dir_mode=0700

machine 'olidell' is running plain Linux 2.6.10
on 'olidell' I get this directory listing:

olivier@olidell:~/pkedu/olivier/bftest$ ls -l
-rw-------  1 olivier olivier 6 Apr 25  2005 testfile.txt

*note*: the file is 6 bytes

now I try to overwrite the contents of the file

olivier@olidell:~/pkedu/olivier/bftest$ echo hallo > testfile.txt
bash: testfile.txt: Permission denied
olivier@olidell:~/pkedu/olivier/bftest$ ls -l
-rw-------  1 olivier olivier 0 Apr 25 13:32 testfile.txt

*note*: although I got a permission denied, the file is truncated to 0 bytes!!!!!

the BUG: 
- I think I have the required permissions to write that file, so I should not
have gotten the "permission denied" error. But much more troubling: Any user who
tries to write this file, will think the original file is still there, and not
expect that file to be truncated!!

extra info: appending to this file over samba works as expected
olivier@olidell:~/pkedu/olivier/bftest$ echo hallo >> testfile.txt
olivier@olidell:~/pkedu/olivier/bftest$

also writing on the file on the server, with the same account, works as expected:
olivier@pkedu:/home/pkedu/olivier/bftest$ echo boe > testfile.txt
olivier@pkedu:/home/pkedu/olivier/bftest$
Comment 1 Olivier Sessink 2005-04-26 05:46:23 UTC
Trying the same server configuration with smbfs on the client-side works as
expected. I get no permission denied, the file is written as expected.
Comment 2 shirishpargaonkar@gmail.com 2009-03-23 09:09:15 UTC
Is this still an issue that needs to be worked on?
Comment 3 shirishpargaonkar@gmail.com 2009-08-27 11:33:49 UTC
I can't recreate this bug.  There was no permission denied and file
did not get truncated to size 0.
Comment 4 Steve French 2009-09-25 15:28:26 UTC
Maybe no longer a problem due to some fixes we did to rename and delete but certainly can't recreate any more