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

[backport/2.16] ldap: fix GetUserByClaim for binary encoded UUIDs #4251

Merged
merged 3 commits into from
Oct 16, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ lint-fix: $(GOLANGCI_LINT)
gofmt -w .
$(GOLANGCI_LINT) run --fix

CALENS_DIR := $(shell mktemp -d)
$(CALENS):
@mkdir -p $(@D)
git clone --depth 1 --branch v0.2.0 -c advice.detachedHead=false https://github.com/restic/calens.git /tmp/calens
cd /tmp/calens && GOBIN=$(@D) go install
rm -rf /tmp/calens
git clone --depth 1 --branch v0.2.0 -c advice.detachedHead=false https://github.com/restic/calens.git $(CALENS_DIR)
cd $(CALENS_DIR) && GOBIN=$(@D) go install
rm -rf $(CALENS_DIR)

.PHONY: check-changelog
check-changelog: $(CALENS)
Expand Down
8 changes: 8 additions & 0 deletions changelog/unreleased/fix-ldap-getuserbyclaim-userid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Bugfix: GetUserByClaim not working with MSAD for claim "userid"

We fixed GetUserByClaim to correctly deal with binary encoded userid
as e.g. used for Active Directory.

https://github.com/cs3org/reva/pull/4251
https://github.com/cs3org/reva/pull/4249
https://github.com/owncloud/ocis/issues/7469
4 changes: 2 additions & 2 deletions pkg/utils/ldap/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ func (i *Identity) getUserAttributeFilter(attribute, value string) (string, erro
default:
return "", errors.New("ldap: invalid field " + attribute)
}
if attribute == "userid" && i.User.Schema.IDIsOctetString {
if attribute == i.User.Schema.ID && i.User.Schema.IDIsOctetString {
id, err := uuid.Parse(value)
if err != nil {
err := errors.Wrap(err, fmt.Sprintf("error parsing OpaqueID '%s' as UUID", value))
Expand Down Expand Up @@ -687,7 +687,7 @@ func (i *Identity) getGroupAttributeFilter(attribute, value string) (string, err
default:
return "", errors.New("ldap: invalid field " + attribute)
}
if attribute == "group_id" && i.Group.Schema.IDIsOctetString {
if attribute == i.Group.Schema.ID && i.Group.Schema.IDIsOctetString {
id, err := uuid.Parse(value)
if err != nil {
err := errors.Wrap(err, fmt.Sprintf("error parsing OpaqueID '%s' as UUID", value))
Expand Down