diff options
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4acl.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c index 5d94555cdc83..785418b0b799 100644 --- a/fs/nfsd/nfs4acl.c +++ b/fs/nfsd/nfs4acl.c | |||
@@ -61,9 +61,11 @@ | |||
61 | 61 | ||
62 | /* flags used to simulate posix default ACLs */ | 62 | /* flags used to simulate posix default ACLs */ |
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) |
65 | 65 | ||
66 | #define NFS4_SUPPORTED_FLAGS (NFS4_INHERITANCE_FLAGS | NFS4_ACE_IDENTIFIER_GROUP) | 66 | #define NFS4_SUPPORTED_FLAGS (NFS4_INHERITANCE_FLAGS \ |
67 | | NFS4_ACE_INHERIT_ONLY_ACE \ | ||
68 | | NFS4_ACE_IDENTIFIER_GROUP) | ||
67 | 69 | ||
68 | #define MASK_EQUAL(mask1, mask2) \ | 70 | #define MASK_EQUAL(mask1, mask2) \ |
69 | ( ((mask1) & NFS4_ACE_MASK_ALL) == ((mask2) & NFS4_ACE_MASK_ALL) ) | 71 | ( ((mask1) & NFS4_ACE_MASK_ALL) == ((mask2) & NFS4_ACE_MASK_ALL) ) |
@@ -707,11 +709,16 @@ nfs4_acl_split(struct nfs4_acl *acl, struct nfs4_acl *dacl) | |||
707 | if (ace->flag & ~NFS4_SUPPORTED_FLAGS) | 709 | if (ace->flag & ~NFS4_SUPPORTED_FLAGS) |
708 | return -EINVAL; | 710 | return -EINVAL; |
709 | 711 | ||
710 | switch (ace->flag & NFS4_INHERITANCE_FLAGS) { | 712 | if ((ace->flag & NFS4_INHERITANCE_FLAGS) == 0) { |
711 | case 0: | ||
712 | /* Leave this ace in the effective acl: */ | 713 | /* Leave this ace in the effective acl: */ |
713 | continue; | 714 | continue; |
714 | case NFS4_INHERITANCE_FLAGS: | 715 | } |
716 | /* | ||
717 | * Note that when only one of FILE_INHERIT or DIRECTORY_INHERIT | ||
718 | * is set, we're effectively turning on the other. That's OK, | ||
719 | * according to rfc 3530. | ||
720 | */ | ||
721 | if (ace->flag & NFS4_ACE_INHERIT_ONLY_ACE) { | ||
715 | /* Add this ace to the default acl and remove it | 722 | /* Add this ace to the default acl and remove it |
716 | * from the effective acl: */ | 723 | * from the effective acl: */ |
717 | error = nfs4_acl_add_ace(dacl, ace->type, ace->flag, | 724 | error = nfs4_acl_add_ace(dacl, ace->type, ace->flag, |
@@ -721,17 +728,13 @@ nfs4_acl_split(struct nfs4_acl *acl, struct nfs4_acl *dacl) | |||
721 | list_del(h); | 728 | list_del(h); |
722 | kfree(ace); | 729 | kfree(ace); |
723 | acl->naces--; | 730 | acl->naces--; |
724 | break; | 731 | } else { |
725 | case NFS4_INHERITANCE_FLAGS & ~NFS4_ACE_INHERIT_ONLY_ACE: | ||
726 | /* Add this ace to the default, but leave it in | 732 | /* Add this ace to the default, but leave it in |
727 | * the effective acl as well: */ | 733 | * the effective acl as well: */ |
728 | error = nfs4_acl_add_ace(dacl, ace->type, ace->flag, | 734 | error = nfs4_acl_add_ace(dacl, ace->type, ace->flag, |
729 | ace->access_mask, ace->whotype, ace->who); | 735 | ace->access_mask, ace->whotype, ace->who); |
730 | if (error) | 736 | if (error) |
731 | return error; | 737 | return error; |
732 | break; | ||
733 | default: | ||
734 | return -EINVAL; | ||
735 | } | 738 | } |
736 | } | 739 | } |
737 | return 0; | 740 | return 0; |