diff options
author | Steve French <sfrench@us.ibm.com> | 2007-02-28 23:11:22 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-02-28 23:11:22 -0500 |
commit | c7af1857ef74873bf5a9c8fcab0cfd79883492ac (patch) | |
tree | 7dbfb8a00ab15062f501faf846dd1c002250fa42 /fs/cifs | |
parent | 99ee4dbd7c99c27129a8e2026003a7680878345f (diff) |
[CIFS] Fix set file size to zero when doing chmod to Samba 3.0.26pre
In fixing a bug Samba 3.0.26pre allowed some clients (including Linux cifs
client) to change file size to zero in SET_FILE_UNIX_BASIC (which Linux cifs
client uses for chmod).
The server has been "fixed" now but that also fixes the client to net send
file size zero on chmod.
Fixes Samba bugzilla bug # 4418.
Fixed with help from Jeremy Allison
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifspdu.h | 3 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 2498d644827c..0efdf35aab2c 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -220,6 +220,9 @@ | |||
220 | */ | 220 | */ |
221 | #define CIFS_NO_HANDLE 0xFFFF | 221 | #define CIFS_NO_HANDLE 0xFFFF |
222 | 222 | ||
223 | #define NO_CHANGE_64 0xFFFFFFFFFFFFFFFFULL | ||
224 | #define NO_CHANGE_32 0xFFFFFFFFUL | ||
225 | |||
223 | /* IPC$ in ASCII */ | 226 | /* IPC$ in ASCII */ |
224 | #define CIFS_IPC_RESOURCE "\x49\x50\x43\x24" | 227 | #define CIFS_IPC_RESOURCE "\x49\x50\x43\x24" |
225 | 228 | ||
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 24364106b8f9..48fc0c2ab0e5 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -4803,6 +4803,16 @@ setPermsRetry: | |||
4803 | pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC); | 4803 | pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC); |
4804 | pSMB->Reserved4 = 0; | 4804 | pSMB->Reserved4 = 0; |
4805 | pSMB->hdr.smb_buf_length += byte_count; | 4805 | pSMB->hdr.smb_buf_length += byte_count; |
4806 | /* Samba server ignores set of file size to zero due to bugs in some | ||
4807 | older clients, but we should be precise - we use SetFileSize to | ||
4808 | set file size and do not want to truncate file size to zero | ||
4809 | accidently as happened on one Samba server beta by putting | ||
4810 | zero instead of -1 here */ | ||
4811 | data_offset->EndOfFile = NO_CHANGE_64; | ||
4812 | data_offset->NumOfBytes = NO_CHANGE_64; | ||
4813 | data_offset->LastStatusChange = NO_CHANGE_64; | ||
4814 | data_offset->LastAccessTime = NO_CHANGE_64; | ||
4815 | data_offset->LastModificationTime = NO_CHANGE_64; | ||
4806 | data_offset->Uid = cpu_to_le64(uid); | 4816 | data_offset->Uid = cpu_to_le64(uid); |
4807 | data_offset->Gid = cpu_to_le64(gid); | 4817 | data_offset->Gid = cpu_to_le64(gid); |
4808 | /* better to leave device as zero when it is */ | 4818 | /* better to leave device as zero when it is */ |