Skip to content

Commit

Permalink
ldap: Fix binary UUID handling in GetUserGroups
Browse files Browse the repository at this point in the history
The LDAP backend for the users service didn't correctly decode binary
UUIDs when looking up a user's group memberships.
  • Loading branch information
rhafer committed Apr 4, 2023
1 parent bb973fa commit 7c1af1e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-ldap-usergroups-binary-uuid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: decode binary UUID when looking up a users group memberships

The LDAP backend for the users service didn't correctly decode binary UUIDs
when looking up a user's group memberships.

https://github.com/cs3org/reva/pull/3767
14 changes: 13 additions & 1 deletion pkg/utils/ldap/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,19 @@ func (i *Identity) GetLDAPUserGroups(log *zerolog.Logger, lc ldap.Client, userEn
// FIXME this makes the users groups use the cn, not an immutable id
// FIXME 1. use the memberof or members attribute of a user to get the groups
// FIXME 2. ook up the id for each group
groups = append(groups, entry.GetEqualFoldAttributeValue(i.Group.Schema.ID))
var groupID string
if i.Group.Schema.IDIsOctetString {
raw := entry.GetEqualFoldRawAttributeValue(i.Group.Schema.ID)
value, err := uuid.FromBytes(raw)
if err != nil {
return nil, err
}
groupID = value.String()
} else {
groupID = entry.GetEqualFoldAttributeValue(i.Group.Schema.ID)
}

groups = append(groups, groupID)
}
return groups, nil
}
Expand Down

0 comments on commit 7c1af1e

Please sign in to comment.