Skip to content

Commit

Permalink
Don't apply the group filter when listing LDAP group membership if it…
Browse files Browse the repository at this point in the history
… is empty (go-gitea#23745)

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

Fix go-gitea#23615

Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath authored and GiteaBot committed Mar 29, 2023
1 parent 81a995c commit 2e06739
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion services/auth/source/ldap/source_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (source *Source) listLdapGroupMemberships(l *ldap.Conn, uid string, applyGr
}

var searchFilter string
if applyGroupFilter {
if applyGroupFilter && groupFilter != "" {
searchFilter = fmt.Sprintf("(&(%s)(%s=%s))", groupFilter, source.GroupMemberUID, ldap.EscapeFilter(uid))
} else {
searchFilter = fmt.Sprintf("(%s=%s)", source.GroupMemberUID, ldap.EscapeFilter(uid))
Expand Down

0 comments on commit 2e06739

Please sign in to comment.