1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
From d55de6fa0c8d2448e55d51ce7b6c9b48fa5632cb Mon Sep 17 00:00:00 2001
From: "J. Bruce Fields" <bfields@snoopy.citi.umich.edu>
Date: Tue, 12 Dec 2006 17:15:14 -0500
Subject: [PATCH 08/17] NFSv4->POSIX: factor out inheritance splitting code
Factor out the code that splits out ACEs that are irrelevant (because of
inheritance bits) into a separate function, do a little more cleanup.
---
libacl/acl_n4tp_acl_trans.c | 56 +++++++++++++++++++++---------------------
1 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/libacl/acl_n4tp_acl_trans.c b/libacl/acl_n4tp_acl_trans.c
index f0f802d..b0d2b54 100644
--- a/libacl/acl_n4tp_acl_trans.c
+++ b/libacl/acl_n4tp_acl_trans.c
@@ -347,16 +347,39 @@ static int process_one_v4_ace(struct posix_acl_state *state,
return 0;
}
+#define FILE_OR_DIR_INHERIT (NFS4_ACE_FILE_INHERIT_ACE \
+ | NFS4_ACE_DIRECTORY_INHERIT_ACE)
+
+/* Strip or keep inheritance aces depending on type of posix acl requested */
+static void acl_nfs4_check_inheritance(struct nfs4_acl *acl, u32 iflags)
+{
+ struct nfs4_ace * cur_ace;
+ struct nfs4_ace * temp_ace;
+
+ cur_ace = acl->ace_head.tqh_first;
+
+ while (cur_ace) {
+ /* get the next ace now in case we free the current ace */
+ temp_ace = cur_ace;
+ cur_ace = cur_ace->l_ace.tqe_next;
+
+ if (iflags & NFS4_ACL_REQUEST_DEFAULT) {
+ if (!(temp_ace->flag & FILE_OR_DIR_INHERIT))
+ acl_nfs4_remove_ace(acl, temp_ace);
+ } else {
+ if (temp_ace->flag & NFS4_ACE_INHERIT_ONLY_ACE)
+ acl_nfs4_remove_ace(acl, temp_ace);
+ }
+ }
+}
+
acl_t acl_n4tp_acl_trans(struct nfs4_acl * nacl_p, acl_type_t ptype)
{
struct posix_acl_state state;
acl_t pacl;
struct nfs4_acl * temp_acl;
- int num_aces;
- struct nfs4_ace * cur_ace = NULL;
- struct nfs4_ace * temp_ace = NULL;
+ struct nfs4_ace * cur_ace;
int ret;
- u32 flags;
u32 iflags = NFS4_ACL_NOFLAGS;
if (nacl_p == NULL) {
@@ -378,30 +401,7 @@ acl_t acl_n4tp_acl_trans(struct nfs4_acl * nacl_p, acl_type_t ptype)
if (temp_acl == NULL)
return NULL;
- num_aces = temp_acl->naces;
-
- /* Strip or keep inheritance aces depending upon the type of posix acl
- * requested */
- cur_ace = temp_acl->ace_head.tqh_first;
-
-#define FILE_OR_DIR_INHERIT (NFS4_ACE_FILE_INHERIT_ACE \
- | NFS4_ACE_DIRECTORY_INHERIT_ACE)
-
- while (cur_ace) {
- /* get the next ace now in case we free the current ace */
- temp_ace = cur_ace;
- cur_ace = cur_ace->l_ace.tqe_next;
-
- flags = temp_ace->flag;
-
- if (iflags & NFS4_ACL_REQUEST_DEFAULT) {
- if (!(temp_ace->flag & FILE_OR_DIR_INHERIT))
- acl_nfs4_remove_ace(temp_acl, temp_ace);
- } else {
- if (temp_ace->flag & NFS4_ACE_INHERIT_ONLY_ACE)
- acl_nfs4_remove_ace(temp_acl, temp_ace);
- }
- }
+ acl_nfs4_check_inheritance(temp_acl, iflags);
ret = init_state(&state, temp_acl->naces);
if (ret)
--
1.7.8.1
|