From 601ae9daf209bd5d682532d6275072ffc27057a1 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Wed, 20 Sep 2017 20:58:09 +0200 Subject: [PATCH] fix(ldap): prevent panic if search error arise (#1216) --- api/ldap/ldap.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/ldap/ldap.go b/api/ldap/ldap.go index 8a280f754..3ad222d05 100644 --- a/api/ldap/ldap.go +++ b/api/ldap/ldap.go @@ -33,7 +33,10 @@ func searchUser(username string, conn *ldap.Conn, settings []portainer.LDAPSearc // Deliberately skip errors on the search request so that we can jump to other search settings // if any issue arise with the current one. - sr, _ := conn.Search(searchRequest) + sr, err := conn.Search(searchRequest) + if err != nil { + continue + } if len(sr.Entries) == 1 { found = true