diff options
author | Simon Beck <simon.beck@vshn.ch> | 2022-02-09 10:36:04 +0100 |
---|---|---|
committer | Gitea <gitea@fake.local> | 2022-02-14 12:13:31 +0100 |
commit | 9ce0d22c99472534838c1afe7c6dffdd0aa659a8 (patch) | |
tree | 014ccdfa0d1f2c77c056a854b5cb05cd9182da68 | |
parent | f05e41c9aad83f3d45aff620a739a116c32b4c47 (diff) | |
download | bottin-9ce0d22c99472534838c1afe7c6dffdd0aa659a8.tar.gz bottin-9ce0d22c99472534838c1afe7c6dffdd0aa659a8.zip |
Fix wrong handling of multi value attributes
While ldapsearch doesn't seem to mind, apps like keycloak seem to have
issues with adding multiple attributes with different values. While
the resulting ldif in ldapsearch is indistinguishable there seems to
be a slight different on the protocol level.
If adding multiple attributes with the same name and different values,
keycloak will only see the last entry. But adding a single attribute
a slice of values is seems to handle it correctly.
-rw-r--r-- | read.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -213,10 +213,11 @@ func (server *Server) handleSearchInternal(state *State, w ldap.ResponseWriter, continue } // Send result + resultVals := []message.AttributeValue{} for _, v := range val { - e.AddAttribute(message.AttributeDescription(attr), - message.AttributeValue(v)) + resultVals = append(resultVals, message.AttributeValue(v)) } + e.AddAttribute(message.AttributeDescription(attr), resultVals...) } w.Write(e) } |