Auth/LDAP: minor tweak for https://github.com/opnsense/core/pull/4784, only log message when there is one.

This commit is contained in:
Ad Schellevis 2021-03-07 10:42:24 +01:00
parent 8ec2c22cac
commit 73030fb528

View File

@ -201,7 +201,9 @@ class LDAP extends Base implements IAuthConnector
ldap_get_option($this->ldapHandle, LDAP_OPT_ERROR_STRING, $error_string);
$error_string = str_replace(array("\n","\r","\t"), ' ', $error_string);
syslog(LOG_ERR, sprintf($message . " [%s; %s]", $error_string, ldap_error($this->ldapHandle)));
$this->lastAuthErrors['error'] = $error_string;
if (!empty($error_string)) {
$this->lastAuthErrors['error'] = $error_string;
}
$this->lastAuthErrors['ldap_error'] = ldap_error($this->ldapHandle);
} else {
syslog(LOG_ERR, $message);