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
|
From 106227f0a4f89724b099114dfb2584b4eb249130 Mon Sep 17 00:00:00 2001
From: "J. Bruce Fields" <bfields@citi.umich.edu>
Date: Tue, 30 Jan 2007 18:45:55 -0500
Subject: [PATCH 12/17] nfsv4->posix mapping: don't add unnecessary masks
Don't add masks to 3-element ACLs unnecessarily; otherwise we never
translate to a posix ACL exactly equivalent to a mode, which seems a
little rude.
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
---
libacl/acl_n4tp_acl_trans.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/libacl/acl_n4tp_acl_trans.c b/libacl/acl_n4tp_acl_trans.c
index a81a06d..eca94ff 100644
--- a/libacl/acl_n4tp_acl_trans.c
+++ b/libacl/acl_n4tp_acl_trans.c
@@ -143,7 +143,10 @@ posix_state_to_acl(struct posix_acl_state *state, int is_dir)
int nace;
int i, error = 0;
- nace = 4 + state->users->n + state->groups->n;
+ if (state->users->n || state->groups->n)
+ nace = 4 + state->users->n + state->groups->n;
+ else
+ nace = 3;
pacl = acl_init(nace);
if (!pacl)
return NULL;
@@ -183,11 +186,13 @@ posix_state_to_acl(struct posix_acl_state *state, int is_dir)
add_to_mask(state, &state->groups->aces[i].perms);
}
- error = acl_create_entry(&pacl, &pace);
- if (error)
- goto out_err;
- acl_set_tag_type(pace, ACL_MASK);
- set_mode_from_nfs4(pace, state->mask.allow, is_dir);
+ if (nace > 3) {
+ error = acl_create_entry(&pacl, &pace);
+ if (error)
+ goto out_err;
+ acl_set_tag_type(pace, ACL_MASK);
+ set_mode_from_nfs4(pace, state->mask.allow, is_dir);
+ }
error = acl_create_entry(&pacl, &pace);
if (error)
--
1.7.8.1
|