From 0e09e09f046fb02879860b869b64457f62ba0061 Mon Sep 17 00:00:00 2001 From: pep-un Date: Fri, 9 Mar 2018 17:58:28 +0100 Subject: [PATCH] bug: Improve LDAP filter in the getUserlist() function (#8253) Improve LDAP filtering to improve the speed of some pages (Dashboard and Edit User mainly). If we don't apply this filter all the users are getted from LDAP and used in to the loop, with 2k users (for us) the page take more than 15 seconds to be loaded. I have check than people still have differante access with this fix. --- LibreNMS/Authentication/LdapAuthorizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibreNMS/Authentication/LdapAuthorizer.php b/LibreNMS/Authentication/LdapAuthorizer.php index d825cf6e83..0cda0efea6 100644 --- a/LibreNMS/Authentication/LdapAuthorizer.php +++ b/LibreNMS/Authentication/LdapAuthorizer.php @@ -136,7 +136,7 @@ class LdapAuthorizer extends AuthorizerBase try { $connection = $this->getLdapConnection(); - $filter = '(' . Config::get('auth_ldap_prefix') . '*)'; + $filter = '(&(' . Config::get('auth_ldap_prefix') . '*)(memberOf=' . trim(Config::get('auth_ldap_group'), ',') . '))'; $search = ldap_search($connection, trim(Config::get('auth_ldap_suffix'), ','), $filter); $entries = ldap_get_entries($connection, $search);