diff --git a/LibreNMS/Authentication/ActiveDirectoryAuthorizer.php b/LibreNMS/Authentication/ActiveDirectoryAuthorizer.php index 35433b7cf0..a3f897af74 100644 --- a/LibreNMS/Authentication/ActiveDirectoryAuthorizer.php +++ b/LibreNMS/Authentication/ActiveDirectoryAuthorizer.php @@ -158,10 +158,13 @@ class ActiveDirectoryAuthorizer extends AuthorizerBase $this->userFilter($username), $attributes ); - $entries = ldap_get_entries($connection, $search); - if ($entries['count']) { - return $this->getUseridFromSid($this->sidFromLdap($entries[0]['objectsid'][0])); + if ($search !== false) { + $entries = ldap_get_entries($connection, $search); + + if ($entries !== false && $entries['count']) { + return $this->getUseridFromSid($this->sidFromLdap($entries[0]['objectsid'][0])); + } } return -1;