Fix reconnectAs() calls

This commit is contained in:
Benjamin Renard 2021-02-17 11:45:39 +01:00
parent d27a59f807
commit fb62ce2eed
2 changed files with 25 additions and 16 deletions

View file

@ -81,10 +81,11 @@ class LSldap extends LSlog_staticLoggerClass {
* @param[in] $dn string Bind DN
* @param[in] $pwd array Bind password
* @param[in] $config array LDAP configuration array in format of Net_LDAP2
* (optional, default: keep current)
*
* @retval boolean true if connected, false instead
*/
public static function reconnectAs($dn,$pwd,$config) {
public static function reconnectAs($dn, $pwd, $config=null) {
if ($config) {
self :: setConfig($config);
}

View file

@ -786,7 +786,11 @@ class LSsession {
self :: $userLDAPcreds = false;
return;
}
if (!LSldap :: reconnectAs(self :: $userLDAPcreds['dn'],self :: $userLDAPcreds['pwd'])) {
if (!LSldap :: reconnectAs(
self :: $userLDAPcreds['dn'],
self :: $userLDAPcreds['pwd'],
self :: $ldapServer['ldap_config']
)) {
LSerror :: addErrorCode('LSsession_15');
return;
}
@ -1239,7 +1243,11 @@ class LSsession {
return;
}
if (self :: $dn && isset(self :: $ldapServer['useUserCredentials']) && self :: $ldapServer['useUserCredentials']) {
LSldap :: reconnectAs(self :: $userLDAPcreds['dn'], self :: $userLDAPcreds['pwd'],self :: $ldapServer['ldap_config']);
LSldap :: reconnectAs(
self :: $userLDAPcreds['dn'],
self :: $userLDAPcreds['pwd'],
self :: $ldapServer['ldap_config']
);
}
else {
LSldap :: connect(self :: $ldapServer['ldap_config']);