[CIFS] ACL support part 5
[sfrench/cifs-2.6.git] / fs / cifs / inode.c
index ece17ca00d0847270bdf3af2e87f1a72c3b96c41..9a5c0c925babac70eda79e3a921d4d9f160a8274 100644 (file)
@@ -527,6 +527,12 @@ int cifs_get_inode_info(struct inode **pinode,
 
                /* BB fill in uid and gid here? with help from winbind?
                   or retrieve from NTFS stream extended attribute */
+#ifdef CONFIG_CIFS_EXPERIMENTAL
+               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
+                       cFYI(1, ("Getting mode bits from ACL"));
+                       get_mode_from_acl(inode, search_path);
+               }
+#endif
                if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
                        /* fill in uid, gid, mode from server ACL */
                        /* BB FIXME this should also take into account the
@@ -947,7 +953,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
                        d_drop(direntry);
                } else {
                        int obj_type;
-                       if (pInfo->Type == -1) /* no return info - go query */ {
+                       if (pInfo->Type == cpu_to_le32(-1)) {
+                               /* no return info, go query for it */
                                kfree(pInfo);
                                goto mkdir_get_info;
                        }
@@ -1569,6 +1576,11 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
        }
 
        time_buf.Attributes = 0;
+
+       /* skip mode change if it's just for clearing setuid/setgid */
+       if (attrs->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID))
+               attrs->ia_valid &= ~ATTR_MODE;
+
        if (attrs->ia_valid & ATTR_MODE) {
                cFYI(1, ("Mode changed to 0x%x", attrs->ia_mode));
                mode = attrs->ia_mode;