Skip to content

Commit

Permalink
eosgrpc: ruggedize code against nil SysACL (cs3org#2302)
Browse files Browse the repository at this point in the history
  • Loading branch information
ffurano authored Nov 22, 2021
1 parent 6e669c0 commit d3f1638
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/sysacl-from-xattr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Enhancement: Add the xattr sys.acl to SysACL (eosgrpc)

https://github.com/cs3org/reva/pull/2252
14 changes: 11 additions & 3 deletions pkg/eosclient/eosgrpc/eosgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1186,9 +1186,17 @@ func (c *Client) List(ctx context.Context, auth eosclient.Authorization, dpath s
mylst = append(mylst, myitem)
}

for _, info := range mylst {
if !info.IsDir && parent != nil {
info.SysACL.Entries = append(info.SysACL.Entries, parent.SysACL.Entries...)
if parent.SysACL != nil {

for _, info := range mylst {
if !info.IsDir && parent != nil {
if info.SysACL == nil {
log.Warn().Str("func", "List").Str("path", dpath).Str("SysACL is nil, taking parent", "").Msg("grpc response")
info.SysACL.Entries = parent.SysACL.Entries
} else {
info.SysACL.Entries = append(info.SysACL.Entries, parent.SysACL.Entries...)
}
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/storage/utils/eosfs/eosfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,13 @@ func (fs *eosfs) permissionSet(ctx context.Context, eosFileInfo *eosclient.FileI
}
}

if eosFileInfo.SysACL == nil {
return &provider.ResourcePermissions{
// no permissions
}
}
var perm provider.ResourcePermissions

for _, e := range eosFileInfo.SysACL.Entries {
var userInGroup bool
if e.Type == acl.TypeGroup {
Expand Down

0 comments on commit d3f1638

Please sign in to comment.