You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2017/03/21 17:47:30 UTC

[06/10] incubator-guacamole-client git commit: GUACAMOLE-102: Change LDAP searches to use global LDAPSearchConstraints instead of instantiating their own each time.

GUACAMOLE-102: Change LDAP searches to use global LDAPSearchConstraints instead of instantiating their own each time.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/b816836e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/b816836e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/b816836e

Branch: refs/heads/master
Commit: b816836e4910bafd8bf0c84ddc9c63db07ac0ba5
Parents: d1635ce
Author: Nick Couchman <ni...@yahoo.com>
Authored: Sun Mar 19 21:09:00 2017 -0400
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Sun Mar 19 21:09:00 2017 -0400

----------------------------------------------------------------------
 .../auth/ldap/connection/ConnectionService.java        | 13 ++-----------
 .../apache/guacamole/auth/ldap/user/UserService.java   | 12 ++----------
 2 files changed, 4 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b816836e/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/connection/ConnectionService.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/connection/ConnectionService.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/connection/ConnectionService.java
index 0ec5ebe..d256ebb 100644
--- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/connection/ConnectionService.java
+++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/connection/ConnectionService.java
@@ -24,7 +24,6 @@ import com.novell.ldap.LDAPAttribute;
 import com.novell.ldap.LDAPConnection;
 import com.novell.ldap.LDAPEntry;
 import com.novell.ldap.LDAPException;
-import com.novell.ldap.LDAPSearchConstraints;
 import com.novell.ldap.LDAPSearchResults;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -109,10 +108,6 @@ public class ConnectionService {
             // current user
             String connectionSearchFilter = getConnectionSearchFilter(userDN, ldapConnection);
 
-            // Set Search Constraints
-            LDAPSearchConstraints constraints = new LDAPSearchConstraints();
-            constraints.setDereference(confService.getDereferenceAliases());
-
             // Find all Guacamole connections for the given user by
             // looking for direct membership in the guacConfigGroup
             // and possibly any groups the user is a member of that are
@@ -123,7 +118,7 @@ public class ConnectionService {
                 connectionSearchFilter,
                 null,
                 false,
-                constraints
+                confService.getLDAPSearchConstraints()
             );
 
             // Build token filter containing credential tokens
@@ -240,10 +235,6 @@ public class ConnectionService {
         String groupBaseDN = confService.getGroupBaseDN();
         if (groupBaseDN != null) {
 
-            // Set up LDAP constraints
-            LDAPSearchConstraints constraints = new LDAPSearchConstraints();
-            constraints.setDereference(confService.getDereferenceAliases());
-
             // Get all groups the user is a member of starting at the groupBaseDN, excluding guacConfigGroups
             LDAPSearchResults userRoleGroupResults = ldapConnection.search(
                 groupBaseDN,
@@ -251,7 +242,7 @@ public class ConnectionService {
                 "(&(!(objectClass=guacConfigGroup))(member=" + escapingService.escapeLDAPSearchFilter(userDN) + "))",
                 null,
                 false,
-                constraints
+                confService.getLDAPSearchConstraints()
             );
 
             // Append the additional user groups to the LDAP filter

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b816836e/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserService.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserService.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserService.java
index c4f6ce0..f7c5716 100644
--- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserService.java
+++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserService.java
@@ -25,7 +25,6 @@ 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;
@@ -85,10 +84,6 @@ public class UserService {
             String usernameAttribute) throws GuacamoleException {
 
         try {
-            // Set search limits
-            LDAPSearchConstraints constraints = new LDAPSearchConstraints();
-            constraints.setMaxResults(confService.getMaxResults());
-            constraints.setDereference(confService.getDereferenceAliases());
 
             // Find all Guacamole users underneath base DN
             LDAPSearchResults results = ldapConnection.search(
@@ -97,7 +92,7 @@ public class UserService {
                 "(&(objectClass=*)(" + escapingService.escapeLDAPSearchFilter(usernameAttribute) + "=*))",
                 null,
                 false,
-                constraints
+                confService.getLDAPSearchConstraints()
             );
 
             // Read all visible users
@@ -248,9 +243,6 @@ public class UserService {
 
             List<String> userDNs = new ArrayList<String>();
 
-            LDAPSearchConstraints constraints = new LDAPSearchConstraints();
-            constraints.setDereference(confService.getDereferenceAliases());
-
             // Find all Guacamole users underneath base DN and matching the
             // specified username
             LDAPSearchResults results = ldapConnection.search(
@@ -259,7 +251,7 @@ public class UserService {
                 generateLDAPQuery(username),
                 null,
                 false,
-                constraints
+                confService.getLDAPSearchConstraints()
             );
 
             // Add all DNs for found users