From f4b1de29ee9056c1664f1420907c64d35f2b6ab6 Mon Sep 17 00:00:00 2001 From: Patrick Teichmann Date: Tue, 24 Aug 2021 12:10:05 +0200 Subject: [PATCH] Fixed issue #17535: Login with LDAP not working --- application/core/plugins/AuthLDAP/AuthLDAP.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/core/plugins/AuthLDAP/AuthLDAP.php b/application/core/plugins/AuthLDAP/AuthLDAP.php index ea0c4d49cb6..fc411665bbb 100644 --- a/application/core/plugins/AuthLDAP/AuthLDAP.php +++ b/application/core/plugins/AuthLDAP/AuthLDAP.php @@ -330,7 +330,7 @@ private function createConnection() } // Try to connect - if (str_pos($ldapserver, 'ldaps://') === false && str_pos($ldapserver, 'ldap://') === false) { + if (strpos($ldapserver, 'ldaps://') === false && strpos($ldapserver, 'ldap://') === false) { $ldapserver = 'ldap://' . $ldapserver; } $ldapconn = ldap_connect($ldapserver . ':' . (int) $ldapport); @@ -350,7 +350,7 @@ private function createConnection() if (!empty($ldaptls) && $ldaptls == '1' && $ldapver == 3 && preg_match("/^ldaps:\/\//", $ldapserver) == 0) { // starting TLS secure layer if (!ldap_start_tls($ldapconn)) { - ldap_close($ldapconn); // all done? close connection + ldap_unbind($ldapconn); // all done? close connection return array("errorCode" => 100, 'errorMessage' => ldap_error($ldapconn)); } }