mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
fix how the option is set, change handle to NULL
This commit is contained in:
parent
6c14c09880
commit
8e7f703af7
@ -170,13 +170,17 @@ class LdapService
|
|||||||
$hostName = $ldapServer[0] . ($hasProtocol?':':'') . $ldapServer[1];
|
$hostName = $ldapServer[0] . ($hasProtocol?':':'') . $ldapServer[1];
|
||||||
$defaultPort = $ldapServer[0] === 'ldaps' ? 636 : 389;
|
$defaultPort = $ldapServer[0] === 'ldaps' ? 636 : 389;
|
||||||
|
|
||||||
$ldapConnection = $this->ldap->connect($hostName, count($ldapServer) > 2 ? intval($ldapServer[2]) : $defaultPort);
|
/*
|
||||||
|
* Check if TLS_INSECURE is set. The handle is set to NULL due to the nature of
|
||||||
// Check if TLS_INSECURE is set
|
* the LDAP_OPT_X_TLS_REQUIRE_CERT option. It can only be set globally and not
|
||||||
|
* per handle.
|
||||||
|
*/
|
||||||
if($this->config['tls_insecure']) {
|
if($this->config['tls_insecure']) {
|
||||||
$this->ldap->setOption($ldapConnection, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_NEVER);
|
$this->ldap->setOption(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_NEVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ldapConnection = $this->ldap->connect($hostName, count($ldapServer) > 2 ? intval($ldapServer[2]) : $defaultPort);
|
||||||
|
|
||||||
if ($ldapConnection === false) {
|
if ($ldapConnection === false) {
|
||||||
throw new LdapException(trans('errors.ldap_cannot_connect'));
|
throw new LdapException(trans('errors.ldap_cannot_connect'));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user