new oclib

This commit is contained in:
mr
2026-01-26 10:38:39 +01:00
parent e1cb9b3a08
commit 076dca0a1d
4 changed files with 5 additions and 2 deletions

View File

@@ -468,6 +468,7 @@ func (c *ldapConn) SearchRoles(attrs ...string) ([]map[string][]string, error) {
// searchEntries executes a LDAP query, and returns a result as entries where each entry is mapping of LDAP attributes.
func (c *ldapConn) searchEntries(baseDN, query string, attrs []string) ([]map[string][]string, error) {
fmt.Println(baseDN, query, attrs)
req := ldap.NewSearchRequest(baseDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, query, attrs, nil)
res, err := c.Search(req)
if err != nil {
@@ -476,7 +477,7 @@ func (c *ldapConn) searchEntries(baseDN, query string, attrs []string) ([]map[st
var entries []map[string][]string
for _, v := range res.Entries {
entry := map[string][]string{"dn": []string{v.DN}}
entry := map[string][]string{"dn": {v.DN}}
for _, attr := range v.Attributes {
// We need the first value only for the named attribute.
entry[attr.Name] = attr.Values