Skip to content

Commit

Permalink
fix: skip acl check when mask is 0 (juicedata#4516)
Browse files Browse the repository at this point in the history
Signed-off-by: jiefenghuang <[email protected]>
  • Loading branch information
jiefenghuang authored Mar 15, 2024
1 parent 04bed7f commit 05a8015
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/meta/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,9 @@ func (m *baseMeta) Access(ctx Context, inode Ino, mmask uint8, attr *Attr) sysca
}
}

if attr.AccessACL != aclAPI.None {
// ref: https://github.com/torvalds/linux/blob/e5eb28f6d1afebed4bb7d740a797d0390bd3a357/fs/namei.c#L352-L357
// dont check acl if mask is 0
if attr.AccessACL != aclAPI.None && (attr.Mode&00070) != 0 {
rule := &aclAPI.Rule{}
if st := m.en.doGetFacl(ctx, inode, aclAPI.TypeAccess, attr.AccessACL, rule); st != 0 {
return st
Expand Down
2 changes: 1 addition & 1 deletion pkg/meta/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func testAccess(t *testing.T, m Meta) {
var testNode Ino = 2
ctx := NewContext(1, 1, []uint32{2})
attr := &Attr{
Mode: 0,
Mode: 0541,
Uid: 0,
Gid: 0,
AccessACL: 1,
Expand Down

0 comments on commit 05a8015

Please sign in to comment.