internal/ldap: Improve search debugging

This commit is contained in:
Michael Aldridge 2020-08-23 15:11:14 -07:00
parent 5789f11056
commit 3c3d6979bc

View file

@ -1,6 +1,7 @@
package ldap package ldap
import ( import (
"fmt"
"context" "context"
"errors" "errors"
"strconv" "strconv"
@ -45,6 +46,8 @@ func (s *server) handleSearchEntities(w ldap.ResponseWriter, m *ldap.Message) {
f := r.Filter().(message.FilterEqualityMatch) f := r.Filter().(message.FilterEqualityMatch)
expr, err = entitySearchExprHelper(string(f.AttributeDesc()), "=", string(f.AssertionValue())) expr, err = entitySearchExprHelper(string(f.AttributeDesc()), "=", string(f.AssertionValue()))
default: default:
s.l.Warn("Unsupported entity search filter", "type", fmt.Sprintf("%T", r.Filter()))
s.l.Debug("Unsupported search filter", "filter", r.FilterString())
err = errors.New("unsupported filter type") err = errors.New("unsupported filter type")
} }
if err != nil { if err != nil {
@ -144,6 +147,8 @@ func (s *server) handleSearchGroups(w ldap.ResponseWriter, m *ldap.Message) {
f := r.Filter().(message.FilterEqualityMatch) f := r.Filter().(message.FilterEqualityMatch)
expr, err = groupSearchExprHelper(string(f.AttributeDesc()), "=", string(f.AssertionValue())) expr, err = groupSearchExprHelper(string(f.AttributeDesc()), "=", string(f.AssertionValue()))
default: default:
s.l.Warn("Unsupported group search filter", "type", fmt.Sprintf("%T", r.Filter()))
s.l.Debug("Unsupported search filter", "filter", r.FilterString())
err = errors.New("unsupported filter type") err = errors.New("unsupported filter type")
} }
if err != nil { if err != nil {