From 9c263b3fb39e597b84b5c771ecda147c070fa4c1 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Thu, 24 Mar 2022 09:11:57 +0100 Subject: [PATCH] ldap: Allow groups to have no gidNumber Similar to the user-provider allow a group to have no gidNumber. Assign a default in that case. --- changelog/unreleased/group-without-gidnumber.md | 6 ++++++ pkg/group/manager/ldap/ldap.go | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 changelog/unreleased/group-without-gidnumber.md diff --git a/changelog/unreleased/group-without-gidnumber.md b/changelog/unreleased/group-without-gidnumber.md new file mode 100644 index 0000000000..9885219b7e --- /dev/null +++ b/changelog/unreleased/group-without-gidnumber.md @@ -0,0 +1,6 @@ +Change: Allow LDAP groups to have no gidNumber + +Similar to the user-provider allow a group to have no gidNumber. Assign +a default in that case. + +https://github.com/cs3org/reva/pull/2667 diff --git a/pkg/group/manager/ldap/ldap.go b/pkg/group/manager/ldap/ldap.go index 1bd5b1fa64..7efd05b2cf 100644 --- a/pkg/group/manager/ldap/ldap.go +++ b/pkg/group/manager/ldap/ldap.go @@ -239,9 +239,14 @@ func (m *manager) GetGroupByClaim(ctx context.Context, claim, value string) (*gr if err != nil { return nil, err } - gidNumber, err := strconv.ParseInt(sr.Entries[0].GetEqualFoldAttributeValue(m.c.Schema.GIDNumber), 10, 64) - if err != nil { - return nil, err + + gidNumber := m.c.Nobody + gidValue := sr.Entries[0].GetEqualFoldAttributeValue(m.c.Schema.GIDNumber) + if gidValue != "" { + gidNumber, err = strconv.ParseInt(gidValue, 10, 64) + if err != nil { + return nil, err + } } g := &grouppb.Group{