feat: in LDAP, search '*' should return all properties (#2511)

This commit is contained in:
Nex Zhu 2023-11-22 23:52:40 +08:00 committed by GitHub
parent 192968bac8
commit a67f541171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,7 +122,14 @@ func handleSearch(w ldap.ResponseWriter, m *ldap.Message) {
e.AddAttribute(message.AttributeDescription("homeDirectory"), message.AttributeValue("/home/"+user.Name))
e.AddAttribute(message.AttributeDescription("cn"), message.AttributeValue(user.Name))
e.AddAttribute(message.AttributeDescription("uid"), message.AttributeValue(user.Id))
for _, attr := range r.Attributes() {
attrs := r.Attributes()
for _, attr := range attrs {
if string(attr) == "*" {
attrs = message.AttributeSelection{"displayname", "email", "mail", "mobile", "title", "userPassword"}
break
}
}
for _, attr := range attrs {
e.AddAttribute(message.AttributeDescription(attr), getAttribute(string(attr), user))
if string(attr) == "cn" {
e.AddAttribute(message.AttributeDescription(attr), getAttribute("title", user))