From 10c0d79eb8f3274db2fd08efd0e45208f2f94b4e Mon Sep 17 00:00:00 2001 From: Chris Mann Date: Sun, 23 Jul 2023 13:42:37 +0200 Subject: [PATCH] G Pas --- gpas.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gpas.go b/gpas.go index d5b4e62..af7efae 100644 --- a/gpas.go +++ b/gpas.go @@ -100,6 +100,14 @@ func passwordFound(user User, config *ConfigFile, ldapConn *ldap.Conn) (string, } searchReq := ldap.NewSearchRequest(user.DN, ldap.ScopeBaseObject, ldap.NeverDerefAliases, 0, 0, false, "", []string{"seeAlso"}, nil) - searchRes, _ := ldapConn.Search(searchReq) - return searchRes.Entries[0].GetAttributeValue("seeAlso"), nil + var searchRes *ldap.SearchResult + searchRes, err = ldapConn.Search(searchReq) + if len(searchRes.Entries) == 0 { + log.Printf("passwordFound %v", err) + log.Printf("passwordFound %v", searchReq) + log.Printf("passwordFound %v", ldapConn) + log.Printf("passwordFound %v", searchRes) + return "", err + } + return searchRes.Entries[0].GetAttributeValue("seeAlso"), err }