diff options
Diffstat (limited to 'fs/xfs/xfs_acl.c')
-rw-r--r-- | fs/xfs/xfs_acl.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c index 306d883d89bc..69518960b2ba 100644 --- a/fs/xfs/xfs_acl.c +++ b/fs/xfs/xfs_acl.c | |||
@@ -16,11 +16,13 @@ | |||
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ | 17 | */ |
18 | #include "xfs.h" | 18 | #include "xfs.h" |
19 | #include "xfs_log_format.h" | ||
20 | #include "xfs_trans_resv.h" | ||
19 | #include "xfs_acl.h" | 21 | #include "xfs_acl.h" |
20 | #include "xfs_attr.h" | 22 | #include "xfs_attr.h" |
21 | #include "xfs_bmap_btree.h" | 23 | #include "xfs_bmap_btree.h" |
22 | #include "xfs_inode.h" | 24 | #include "xfs_inode.h" |
23 | #include "xfs_vnodeops.h" | 25 | #include "xfs_ag.h" |
24 | #include "xfs_sb.h" | 26 | #include "xfs_sb.h" |
25 | #include "xfs_mount.h" | 27 | #include "xfs_mount.h" |
26 | #include "xfs_trace.h" | 28 | #include "xfs_trace.h" |
@@ -68,14 +70,15 @@ xfs_acl_from_disk( | |||
68 | 70 | ||
69 | switch (acl_e->e_tag) { | 71 | switch (acl_e->e_tag) { |
70 | case ACL_USER: | 72 | case ACL_USER: |
73 | acl_e->e_uid = xfs_uid_to_kuid(be32_to_cpu(ace->ae_id)); | ||
74 | break; | ||
71 | case ACL_GROUP: | 75 | case ACL_GROUP: |
72 | acl_e->e_id = be32_to_cpu(ace->ae_id); | 76 | acl_e->e_gid = xfs_gid_to_kgid(be32_to_cpu(ace->ae_id)); |
73 | break; | 77 | break; |
74 | case ACL_USER_OBJ: | 78 | case ACL_USER_OBJ: |
75 | case ACL_GROUP_OBJ: | 79 | case ACL_GROUP_OBJ: |
76 | case ACL_MASK: | 80 | case ACL_MASK: |
77 | case ACL_OTHER: | 81 | case ACL_OTHER: |
78 | acl_e->e_id = ACL_UNDEFINED_ID; | ||
79 | break; | 82 | break; |
80 | default: | 83 | default: |
81 | goto fail; | 84 | goto fail; |
@@ -101,7 +104,18 @@ xfs_acl_to_disk(struct xfs_acl *aclp, const struct posix_acl *acl) | |||
101 | acl_e = &acl->a_entries[i]; | 104 | acl_e = &acl->a_entries[i]; |
102 | 105 | ||
103 | ace->ae_tag = cpu_to_be32(acl_e->e_tag); | 106 | ace->ae_tag = cpu_to_be32(acl_e->e_tag); |
104 | ace->ae_id = cpu_to_be32(acl_e->e_id); | 107 | switch (acl_e->e_tag) { |
108 | case ACL_USER: | ||
109 | ace->ae_id = cpu_to_be32(xfs_kuid_to_uid(acl_e->e_uid)); | ||
110 | break; | ||
111 | case ACL_GROUP: | ||
112 | ace->ae_id = cpu_to_be32(xfs_kgid_to_gid(acl_e->e_gid)); | ||
113 | break; | ||
114 | default: | ||
115 | ace->ae_id = cpu_to_be32(ACL_UNDEFINED_ID); | ||
116 | break; | ||
117 | } | ||
118 | |||
105 | ace->ae_perm = cpu_to_be16(acl_e->e_perm); | 119 | ace->ae_perm = cpu_to_be16(acl_e->e_perm); |
106 | } | 120 | } |
107 | } | 121 | } |
@@ -360,7 +374,7 @@ xfs_xattr_acl_set(struct dentry *dentry, const char *name, | |||
360 | return -EINVAL; | 374 | return -EINVAL; |
361 | if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode)) | 375 | if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode)) |
362 | return value ? -EACCES : 0; | 376 | return value ? -EACCES : 0; |
363 | if ((current_fsuid() != inode->i_uid) && !capable(CAP_FOWNER)) | 377 | if (!inode_owner_or_capable(inode)) |
364 | return -EPERM; | 378 | return -EPERM; |
365 | 379 | ||
366 | if (!value) | 380 | if (!value) |