Compare commits
2 Commits
v1.0.0-rc3
...
v1.0.1
Author | SHA1 | Date | |
---|---|---|---|
8ac556ad8b | |||
6e9947809c |
@ -26,7 +26,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
version = "1.0.0-rc3"
|
||||
version = "1.0.1"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -227,7 +227,12 @@ func handleConnection(connClt net.Conn, conLdap *ldap.Conn) {
|
||||
// First query netCache built with ipNetworkNumber
|
||||
res, err := isIPContainedInNetCache(ip)
|
||||
if err != nil {
|
||||
if strings.EqualFold(err.Error(), fmt.Sprintf("Invalid IP: %s", ip)) {
|
||||
// We don't want those msg to pollute logs
|
||||
logstream.Info(err.Error())
|
||||
} else {
|
||||
logstream.Error(err.Error())
|
||||
}
|
||||
sendResponse(connClt, err.Error(), 500)
|
||||
continue
|
||||
}
|
||||
@ -279,7 +284,11 @@ func searchLdap(searchReq *ldap.SearchRequest, attempt int) (*ldap.SearchResult,
|
||||
if err != nil && strings.HasSuffix(err.Error(), "ldap: connection closed") {
|
||||
logstream.Error("LDAP connection closed, retrying")
|
||||
mutex.Lock()
|
||||
// 16/01/2023: panic: runtime error: invalid memory address or nil pointer dereference
|
||||
// probably bc connection is already closed
|
||||
if conLdap != nil {
|
||||
conLdap.Close()
|
||||
}
|
||||
conLdap, err = connectLdap()
|
||||
mutex.Unlock()
|
||||
if err != nil {
|
||||
@ -297,12 +306,12 @@ func connectLdap() (*ldap.Conn, error) {
|
||||
conLdap, err = ldap.DialURL(*ldapURL)
|
||||
if err != nil {
|
||||
logstream.Errorf("Error dialing LDAP on %s: %v\n", *ldapURL, err)
|
||||
return conLdap, err
|
||||
return nil, err
|
||||
}
|
||||
err = conLdap.Bind(*ldapUser, *ldapPass)
|
||||
if err != nil {
|
||||
logstream.Errorf("Error binding LDAP: %s", err)
|
||||
return conLdap, err
|
||||
return nil, err
|
||||
}
|
||||
return conLdap, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user