From f91f8874dc700e48b429d36bd94ae8d6a20c4fbe Mon Sep 17 00:00:00 2001 From: William Luke Date: Fri, 5 Jul 2024 17:25:13 -0500 Subject: [PATCH] Fix the base DN searches --- internal/ldap/search.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/internal/ldap/search.go b/internal/ldap/search.go index 6935fd9..881e3f7 100644 --- a/internal/ldap/search.go +++ b/internal/ldap/search.go @@ -15,13 +15,16 @@ import ( func (s *server) handleSearchDSE(w ldap.ResponseWriter, m *ldap.Message) { nc := strings.Join(s.nc, ",") + r := m.GetSearchRequest() e := ldap.NewSearchResultEntry("") - e.AddAttribute("vendorName", "NetAuth") - e.AddAttribute("vendorVersion", message.AttributeValue(buildinfo.Version)) - e.AddAttribute("objectClass", "top", "extensibleObject") - e.AddAttribute("supportedLDAPVersion", "3") - e.AddAttribute("namingContexts", message.AttributeValue(nc)) + if len(r.Attributes()) == 0 { + e.AddAttribute("vendorName", "NetAuth") + e.AddAttribute("vendorVersion", message.AttributeValue(buildinfo.Version)) + e.AddAttribute("objectClass", "top", "extensibleObject") + e.AddAttribute("supportedLDAPVersion", "3") + e.AddAttribute("namingContexts", message.AttributeValue(nc)) + } w.Write(e) res := ldap.NewSearchResultDoneResponse(ldap.LDAPResultSuccess)