Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c7af1857ef74873bf5a9c8fcab0cfd79883492ac
Commit:     c7af1857ef74873bf5a9c8fcab0cfd79883492ac
Parent:     99ee4dbd7c99c27129a8e2026003a7680878345f
Author:     Steve French <[EMAIL PROTECTED]>
AuthorDate: Thu Mar 1 04:11:22 2007 +0000
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Thu Mar 1 04:11:22 2007 +0000

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/cifspdu.h |    3 +++
 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 2498d64..0efdf35 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -220,6 +220,9 @@
  */
 #define CIFS_NO_HANDLE        0xFFFF
 
+#define NO_CHANGE_64          0xFFFFFFFFFFFFFFFFULL
+#define NO_CHANGE_32          0xFFFFFFFFUL
+
 /* IPC$ in ASCII */
 #define CIFS_IPC_RESOURCE "\x49\x50\x43\x24"
 
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 2436410..48fc0c2 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -4803,6 +4803,16 @@ setPermsRetry:
        pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC);
        pSMB->Reserved4 = 0;
        pSMB->hdr.smb_buf_length += byte_count;
+       /* Samba server ignores set of file size to zero due to bugs in some
+       older clients, but we should be precise - we use SetFileSize to
+       set file size and do not want to truncate file size to zero
+       accidently as happened on one Samba server beta by putting
+       zero instead of -1 here */ 
+       data_offset->EndOfFile = NO_CHANGE_64;
+       data_offset->NumOfBytes = NO_CHANGE_64;
+       data_offset->LastStatusChange = NO_CHANGE_64;
+       data_offset->LastAccessTime = NO_CHANGE_64;
+       data_offset->LastModificationTime = NO_CHANGE_64;
        data_offset->Uid = cpu_to_le64(uid);
        data_offset->Gid = cpu_to_le64(gid);
        /* better to leave device as zero when it is  */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to