]> err.no Git - linux-2.6/commitdiff
[CIFS] Add write perm for usr to file on windows should remove r/o dos attr
authorSteve French <sfrench@us.ibm.com>
Fri, 6 Apr 2007 19:28:16 +0000 (19:28 +0000)
committerSteve French <sfrench@us.ibm.com>
Fri, 6 Apr 2007 19:28:16 +0000 (19:28 +0000)
Remove read only dos attribute on chmod when adding any write permission (ie on any of
user/group/other (not all of user/group/other ie  0222) when
mounted to windows.

Suggested by: Urs Fleisch

Signed-off-by: Urs Fleisch <urs.fleisch@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/CHANGES
fs/cifs/inode.c

index 5d1f4873d7016543623d9f990ee1fd1a3471fc74..f75bdc6617693e1fe583ec22b7398f754ed58466 100644 (file)
@@ -9,7 +9,10 @@ from read-only back to read-write, reflect this change in default file mode
 (we had been leaving a file's mode read-only until the inode were reloaded).
 Allow setting of attribute back to ATTR_NORMAL (removing readonly dos attribute
 when archive dos attribute not set and we are changing mode back to writeable
-on server which does not support the Unix Extensions).
+on server which does not support the Unix Extensions).  Remove read only dos
+attribute on chmod when adding any write permission (ie on any of
+user/group/other (not all of user/group/other ie  0222) when
+mounted to windows.
 
 Version 1.47
 ------------
index f414526e476ab85221dbb79be24c64bf34fa76cd..eeea33752e682fe6d0bce4aeda65dbdaec646b40 100644 (file)
@@ -1339,17 +1339,17 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
                                        cpu_to_le32(cifsInode->cifsAttrs |
                                                    ATTR_READONLY);
                        }
-               } else if ((mode & S_IWUGO) == S_IWUGO) {
-                       if (cifsInode->cifsAttrs & ATTR_READONLY) {
-                               set_dosattr = TRUE;
-                               time_buf.Attributes =
-                                       cpu_to_le32(cifsInode->cifsAttrs &
-                                                   (~ATTR_READONLY));
-                               /* Windows ignores set to zero */
-                               if(time_buf.Attributes == 0)
-                                       time_buf.Attributes |= 
-                                               cpu_to_le32(ATTR_NORMAL);
-                       }
+               } else if (cifsInode->cifsAttrs & ATTR_READONLY) {
+                       /* If file is readonly on server, we would
+                       not be able to write to it - so if any write
+                       bit is enabled for user or group or other we
+                       need to at least try to remove r/o dos attr */
+                       set_dosattr = TRUE;
+                       time_buf.Attributes = cpu_to_le32(cifsInode->cifsAttrs &
+                                           (~ATTR_READONLY));
+                       /* Windows ignores set to zero */
+                       if(time_buf.Attributes == 0)
+                               time_buf.Attributes |= cpu_to_le32(ATTR_NORMAL);
                }
                /* BB to be implemented -
                   via Windows security descriptors or streams */