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

ldap: Fix binary UUID handling in GetUserGroups #3767

Merged
merged 1 commit into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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