mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-79: Merge changes allowing LDAP result size limits to be overridden.
This commit is contained in:
@@ -206,4 +206,23 @@ public class ConfigurationService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns maximum number of results a LDAP query can return,
|
||||
* as configured with guacamole.properties.
|
||||
* By default, this will be 1000.
|
||||
*
|
||||
* @return
|
||||
* The maximum number of results a LDAP query can return,
|
||||
* as configured with guacamole.properties.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If guacamole.properties cannot be parsed.
|
||||
*/
|
||||
public int getMaxResults() throws GuacamoleException {
|
||||
return environment.getProperty(
|
||||
LDAPGuacamoleProperties.LDAP_MAX_SEARCH_RESULTS,
|
||||
1000
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -145,4 +145,14 @@ public class LDAPGuacamoleProperties {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* The maximum number of results a LDAP query can return.
|
||||
*/
|
||||
public static final IntegerGuacamoleProperty LDAP_MAX_SEARCH_RESULTS = new IntegerGuacamoleProperty() {
|
||||
|
||||
@Override
|
||||
public String getName() { return "ldap-max-search-results"; }
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.novell.ldap.LDAPConnection;
|
||||
import com.novell.ldap.LDAPEntry;
|
||||
import com.novell.ldap.LDAPException;
|
||||
import com.novell.ldap.LDAPSearchResults;
|
||||
import com.novell.ldap.LDAPSearchConstraints;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -86,6 +87,9 @@ public class UserService {
|
||||
String usernameAttribute) throws GuacamoleException {
|
||||
|
||||
try {
|
||||
// Set search limits
|
||||
LDAPSearchConstraints constraints = new LDAPSearchConstraints();
|
||||
constraints.setMaxResults(confService.getMaxResults());
|
||||
|
||||
// Find all Guacamole users underneath base DN
|
||||
LDAPSearchResults results = ldapConnection.search(
|
||||
@@ -93,7 +97,8 @@ public class UserService {
|
||||
LDAPConnection.SCOPE_SUB,
|
||||
"(&(objectClass=*)(" + escapingService.escapeLDAPSearchFilter(usernameAttribute) + "=*))",
|
||||
null,
|
||||
false
|
||||
false,
|
||||
constraints
|
||||
);
|
||||
|
||||
// Read all visible users
|
||||
|
Reference in New Issue
Block a user