From f40d85459252b65bc596e754ac7c35a8b8286a19 Mon Sep 17 00:00:00 2001 From: ralf Date: Thu, 10 Nov 2022 11:26:45 +0100 Subject: [PATCH] return which AD server we (tried) to contact in error-messages --- api/src/Accounts/Ads.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/api/src/Accounts/Ads.php b/api/src/Accounts/Ads.php index 00ea6391df..cbd7e853f2 100644 --- a/api/src/Accounts/Ads.php +++ b/api/src/Accounts/Ads.php @@ -1547,6 +1547,23 @@ class adLDAP extends \adLDAP } return $this->utilClass; } + + /** + * Get last error from Active Directory. + * + * Reimplemented to return which AD we're connecting. + * + * return string + */ + public function getLastError() + { + $url = $this->useTLS ? 'ldaps://' : 'ldap://'; + if (!empty($this->adminUsername)) $url .= $this->adminUsername.'@'.$this->accountSuffix.'@'; + $url .= implode(',', $this->domainControllers); + if (!empty($this->adPort)) $url .= ':'.$this->adPort; + + return $url.': '.parent::getLastError(); + } } /**