diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4acl.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c index f2f66b3da7ac..59fdd9c1d3ee 100644 --- a/fs/nfsd/nfs4acl.c +++ b/fs/nfsd/nfs4acl.c | |||
@@ -63,6 +63,8 @@ | |||
63 | #define NFS4_INHERITANCE_FLAGS (NFS4_ACE_FILE_INHERIT_ACE \ | 63 | #define NFS4_INHERITANCE_FLAGS (NFS4_ACE_FILE_INHERIT_ACE \ |
64 | | NFS4_ACE_DIRECTORY_INHERIT_ACE | NFS4_ACE_INHERIT_ONLY_ACE) | 64 | | NFS4_ACE_DIRECTORY_INHERIT_ACE | NFS4_ACE_INHERIT_ONLY_ACE) |
65 | 65 | ||
66 | #define NFS4_SUPPORTED_FLAGS (NFS4_INHERITANCE_FLAGS | NFS4_ACE_IDENTIFIER_GROUP) | ||
67 | |||
66 | #define MASK_EQUAL(mask1, mask2) \ | 68 | #define MASK_EQUAL(mask1, mask2) \ |
67 | ( ((mask1) & NFS4_ACE_MASK_ALL) == ((mask2) & NFS4_ACE_MASK_ALL) ) | 69 | ( ((mask1) & NFS4_ACE_MASK_ALL) == ((mask2) & NFS4_ACE_MASK_ALL) ) |
68 | 70 | ||
@@ -721,22 +723,37 @@ nfs4_acl_split(struct nfs4_acl *acl, struct nfs4_acl *dacl) | |||
721 | ace->type != NFS4_ACE_ACCESS_DENIED_ACE_TYPE) | 723 | ace->type != NFS4_ACE_ACCESS_DENIED_ACE_TYPE) |
722 | return -EINVAL; | 724 | return -EINVAL; |
723 | 725 | ||
724 | if ((ace->flag & NFS4_INHERITANCE_FLAGS) | 726 | if (ace->flag & ~NFS4_SUPPORTED_FLAGS) |
725 | != NFS4_INHERITANCE_FLAGS) | 727 | return -EINVAL; |
726 | continue; | ||
727 | 728 | ||
728 | error = nfs4_acl_add_ace(dacl, ace->type, ace->flag, | 729 | switch (ace->flag & NFS4_INHERITANCE_FLAGS) { |
730 | case 0: | ||
731 | /* Leave this ace in the effective acl: */ | ||
732 | continue; | ||
733 | case NFS4_INHERITANCE_FLAGS: | ||
734 | /* Add this ace to the default acl and remove it | ||
735 | * from the effective acl: */ | ||
736 | error = nfs4_acl_add_ace(dacl, ace->type, ace->flag, | ||
729 | ace->access_mask, ace->whotype, ace->who); | 737 | ace->access_mask, ace->whotype, ace->who); |
730 | if (error < 0) | 738 | if (error) |
731 | goto out; | 739 | return error; |
732 | 740 | list_del(h); | |
733 | list_del(h); | 741 | kfree(ace); |
734 | kfree(ace); | 742 | acl->naces--; |
735 | acl->naces--; | 743 | break; |
744 | case NFS4_INHERITANCE_FLAGS & ~NFS4_ACE_INHERIT_ONLY_ACE: | ||
745 | /* Add this ace to the default, but leave it in | ||
746 | * the effective acl as well: */ | ||
747 | error = nfs4_acl_add_ace(dacl, ace->type, ace->flag, | ||
748 | ace->access_mask, ace->whotype, ace->who); | ||
749 | if (error) | ||
750 | return error; | ||
751 | break; | ||
752 | default: | ||
753 | return -EINVAL; | ||
754 | } | ||
736 | } | 755 | } |
737 | 756 | return 0; | |
738 | out: | ||
739 | return error; | ||
740 | } | 757 | } |
741 | 758 | ||
742 | static short | 759 | static short |