From d768cc7d94b8abc79865419af6a4b7e8b177eb4e 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 497c36a3f5..bee6301c69 100644 --- a/api/src/Accounts/Ads.php +++ b/api/src/Accounts/Ads.php @@ -1456,6 +1456,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(); + } } /**