From b17f6f851419f7fcf9927ba626bc794ba761f253 Mon Sep 17 00:00:00 2001 From: stonezdj Date: Tue, 14 May 2019 19:11:48 +0800 Subject: [PATCH] fix issue7793: ping ldap server is always success Signed-off-by: stonezdj --- src/core/api/ldap.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/api/ldap.go b/src/core/api/ldap.go index 8de8e8f1a..1f0a84bdc 100644 --- a/src/core/api/ldap.go +++ b/src/core/api/ldap.go @@ -79,10 +79,10 @@ func (l *LdapAPI) Prepare() { // Ping ... func (l *LdapAPI) Ping() { + var err error var ldapConfs = models.LdapConf{ LdapConnectionTimeout: 5, } - var err error l.Ctx.Input.CopyBody(1 << 32) @@ -90,7 +90,8 @@ func (l *LdapAPI) Ping() { ldapSession := *l.ldapConfig err = ldapSession.ConnectionTest() } else { - isValid, err := l.DecodeJSONReqAndValidate(&ldapConfs) + var isValid bool + isValid, err = l.DecodeJSONReqAndValidate(&ldapConfs) if !isValid { l.SendBadRequestError(err) return