FIX show connected server if we have a primary and secondary ldap server
This commit is contained in:
parent
97d97af932
commit
72484961ab
@ -297,17 +297,17 @@ if (function_exists("ldap_connect")) {
|
|||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
// Test ldap connect and bind
|
// Test ldap connect and bind
|
||||||
print img_picto('', 'info').' ';
|
print img_picto('', 'info').' ';
|
||||||
print '<span class="ok">'.$langs->trans("LDAPTCPConnectOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</span>';
|
print '<span class="ok">'.$langs->trans("LDAPTCPConnectOK", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT).'</span>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
if ($conf->global->LDAP_ADMIN_DN && !empty($conf->global->LDAP_ADMIN_PASS)) {
|
if (!empty($conf->global->LDAP_ADMIN_DN) && !empty($conf->global->LDAP_ADMIN_PASS)) {
|
||||||
if ($result == 2) {
|
if ($result == 2) {
|
||||||
print img_picto('', 'info').' ';
|
print img_picto('', 'info').' ';
|
||||||
print '<span class="ok">'.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
|
print '<span class="ok">'.$langs->trans("LDAPBindOK", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
} else {
|
} else {
|
||||||
print img_picto('', 'error').' ';
|
print img_picto('', 'error').' ';
|
||||||
print '<span class="error">'.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
|
print '<span class="error">'.$langs->trans("LDAPBindKO", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print $langs->trans("Error").' '.$ldap->error;
|
print $langs->trans("Error").' '.$ldap->error;
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -333,7 +333,7 @@ if (function_exists("ldap_connect")) {
|
|||||||
$unbind = $ldap->unbind();
|
$unbind = $ldap->unbind();
|
||||||
} else {
|
} else {
|
||||||
print img_picto('', 'error').' ';
|
print img_picto('', 'error').' ';
|
||||||
print '<span class="error">'.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</span>';
|
print '<span class="error">'.$langs->trans("LDAPTCPConnectKO", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT).'</span>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print $langs->trans("Error").' '.$ldap->error;
|
print $langs->trans("Error").' '.$ldap->error;
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2021 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2021 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -48,6 +48,11 @@ class Ldap
|
|||||||
*/
|
*/
|
||||||
public $server = array();
|
public $server = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current connected server
|
||||||
|
*/
|
||||||
|
public $connectedServer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base DN (e.g. "dc=foo,dc=com")
|
* Base DN (e.g. "dc=foo,dc=com")
|
||||||
*/
|
*/
|
||||||
@ -159,8 +164,6 @@ class Ldap
|
|||||||
$this->attr_mobile = $conf->global->LDAP_FIELD_MOBILE;
|
$this->attr_mobile = $conf->global->LDAP_FIELD_MOBILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Connection handling methods -------------------------------------------
|
// Connection handling methods -------------------------------------------
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
@ -288,6 +291,7 @@ class Ldap
|
|||||||
$return = -1;
|
$return = -1;
|
||||||
dol_syslog(get_class($this)."::connect_bind return=".$return.' - '.$this->error, LOG_WARNING);
|
dol_syslog(get_class($this)."::connect_bind return=".$return.' - '.$this->error, LOG_WARNING);
|
||||||
}
|
}
|
||||||
|
$this->connectedServer = $host;
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user