diff options
Diffstat (limited to 'read.go')
-rw-r--r-- | read.go | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -25,11 +25,10 @@ func (server *Server) handleCompare(s ldap.UserState, w ldap.ResponseWriter, m * } func (server *Server) handleCompareInternal(state *State, r *message.CompareRequest) (int, error) { - dn := string(r.Entry()) attr := string(r.Ava().AttributeDesc()) expected := string(r.Ava().AssertionValue()) - _, err := server.checkSuffix(dn, false) + dn, err := server.checkDN(string(r.Entry()), false) if err != nil { return ldap.LDAPResultInvalidDNSyntax, err } @@ -82,21 +81,22 @@ func (server *Server) handleSearch(s ldap.UserState, w ldap.ResponseWriter, m *l func (server *Server) handleSearchInternal(state *State, w ldap.ResponseWriter, r *message.SearchRequest) (int, error) { + baseObject, err := server.checkDN(string(r.BaseObject()), true) + if err != nil { + return ldap.LDAPResultInvalidDNSyntax, err + } + server.logger.Tracef("-- SEARCH REQUEST: --") - server.logger.Tracef("Request BaseDn=%s", r.BaseObject()) + server.logger.Tracef("Request BaseDn=%s", baseObject) server.logger.Tracef("Request Filter=%s", r.Filter()) server.logger.Tracef("Request FilterString=%s", r.FilterString()) server.logger.Tracef("Request Attributes=%s", r.Attributes()) server.logger.Tracef("Request TimeLimit=%d", r.TimeLimit().Int()) - if !server.config.Acl.Check(&state.login, "read", string(r.BaseObject()), []string{}) { + if !server.config.Acl.Check(&state.login, "read", baseObject, []string{}) { return ldap.LDAPResultInsufficientAccessRights, fmt.Errorf("Please specify a base object on which you have read rights") } - baseObject, err := server.checkSuffix(string(r.BaseObject()), true) - if err != nil { - return ldap.LDAPResultInvalidDNSyntax, err - } basePath, err := dnToConsul(baseObject) if err != nil { return ldap.LDAPResultInvalidDNSyntax, err @@ -206,7 +206,7 @@ func applyFilter(entry Entry, filter message.Filter) (bool, error) { for entry_desc, value := range entry { if strings.EqualFold(entry_desc, desc) { for _, val := range value { - if val == target { + if valueMatch(entry_desc, val, target) { return true, nil } } |