Log better information about the connection to the server

This commit is contained in:
Andrew Ruthven 2024-01-22 02:15:10 +13:00
parent 30b05549d0
commit 15e5a89675

View File

@ -65,16 +65,23 @@ class ldapDriver
$this->connect=ldap_connect($host);
if (! $this->connect){
if (isset($config['uri']))
if (isset($config['uri'])) {
$c->messages[] = sprintf(translate( 'drivers_ldap : Unable to connect to LDAP with URI: %s'), $config['uri'] );
else
} else {
if (! $port) $port = 'default';
$c->messages[] = sprintf(translate( 'drivers_ldap : Unable to connect to LDAP with port %s on host %s'), $port, $host );
}
$this->valid=false;
return ;
} else {
if (isset($config['uri']))
dbg_error_log( "LDAP", "drivers_ldap : Connected to LDAP server %s", $config['uri'] );
elseif ($port)
dbg_error_log( "LDAP", "drivers_ldap : Connected to LDAP server %s, port %s", $host, $port );
else
dbg_error_log( "LDAP", "drivers_ldap : Connected to LDAP server %s", $host );
}
dbg_error_log( "LDAP", "drivers_ldap : Connected to LDAP server %s",$host );
// Start TLS if desired (requires protocol version 3)
if (isset($config['startTLS'])) {
if (!ldap_set_option($this->connect, LDAP_OPT_PROTOCOL_VERSION, 3)) {