Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eosgrpc: ruggedize code against nil SysACL #2302

Merged
merged 10 commits into from
Nov 22, 2021
Merged
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