Don't apply the group filter when listing LDAP group membership if it is empty (#23745) (#23788)

Backport #23745 by @zeripath

When running listLdapGroupMemberships check if the groupFilter is empty
before using it to list memberships.

Fix #23615

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
pull/23781/head^2
Giteabot 2 years ago committed by GitHub
parent d27e693ecf
commit 494721cc90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      services/auth/source/ldap/source_search.go

@ -208,7 +208,7 @@ func (source *Source) listLdapGroupMemberships(l *ldap.Conn, uid string, applyGr
} }
var searchFilter string var searchFilter string
if applyGroupFilter { if applyGroupFilter && groupFilter != "" {
searchFilter = fmt.Sprintf("(&(%s)(%s=%s))", groupFilter, source.GroupMemberUID, ldap.EscapeFilter(uid)) searchFilter = fmt.Sprintf("(&(%s)(%s=%s))", groupFilter, source.GroupMemberUID, ldap.EscapeFilter(uid))
} else { } else {
searchFilter = fmt.Sprintf("(%s=%s)", source.GroupMemberUID, ldap.EscapeFilter(uid)) searchFilter = fmt.Sprintf("(%s=%s)", source.GroupMemberUID, ldap.EscapeFilter(uid))

Loading…
Cancel
Save