GUACAMOLE-234: Fix style, debug messages, and logger output.

This commit is contained in:
Virtually Nick
2019-08-10 22:14:56 -04:00
parent 8c1a3f3435
commit 8b172a98fc
4 changed files with 25 additions and 11 deletions

View File

@@ -197,8 +197,8 @@ public class LDAPConnectionService {
* If an error occurs parsing out the LdapUrl object or the * If an error occurs parsing out the LdapUrl object or the
* maximum number of referral hops is reached. * maximum number of referral hops is reached.
*/ */
public LdapNetworkConnection referralConnection(LdapUrl referralUrl, public LdapNetworkConnection getReferralConnection(LdapUrl referralUrl,
LdapConnectionConfig ldapConfig, int hop) LdapConnectionConfig ldapConfig, int hop)
throws GuacamoleException { throws GuacamoleException {
if (hop >= confService.getMaxReferralHops()) if (hop >= confService.getMaxReferralHops())

View File

@@ -171,7 +171,8 @@ public class ObjectQueryService {
* The LDAP query to execute. * The LDAP query to execute.
* *
* @param searchHop * @param searchHop
* The level of depth for this search, used for tracking referrals. * The current level of referral depth for this search, used for
* limiting the maximum depth to which referrals can go.
* *
* @return * @return
* A list of all results accessible to the user currently bound under * A list of all results accessible to the user currently bound under
@@ -209,9 +210,13 @@ public class ObjectQueryService {
Referral referral = results.getReferral(); Referral referral = results.getReferral();
for (String url : referral.getLdapUrls()) { for (String url : referral.getLdapUrls()) {
LdapNetworkConnection referralConnection = ldapService.referralConnection( LdapNetworkConnection referralConnection =
new LdapUrl(url), ldapConnectionConfig, searchHop++); ldapService.getReferralConnection(
entries.addAll(search(referralConnection, baseDN, query, searchHop)); new LdapUrl(url),
ldapConnectionConfig, searchHop++
);
entries.addAll(search(referralConnection, baseDN, query,
searchHop));
} }
} }

View File

@@ -115,7 +115,7 @@ public class ConnectionService {
// getConnections() will only be called after a connection has been // getConnections() will only be called after a connection has been
// authenticated (via non-anonymous bind), thus userDN cannot // authenticated (via non-anonymous bind), thus userDN cannot
// possibly be null // possibly be null
assert (userDN != null); assert(userDN != null);
// Get the search filter for finding connections accessible by the // Get the search filter for finding connections accessible by the
// current user // current user
@@ -145,7 +145,9 @@ public class ConnectionService {
cnName = cn.getString(); cnName = cn.getString();
} }
catch (LdapInvalidAttributeValueException e) { catch (LdapInvalidAttributeValueException e) {
logger.error("Invalid value for CN attribute.", e.getMessage()); logger.error("Invalid value for CN attribute: {}",
e.getMessage());
logger.debug("LDAP exception while getting CN attribute.", e);
return null; return null;
} }
@@ -164,7 +166,9 @@ public class ConnectionService {
config.setProtocol(protocol.getString()); config.setProtocol(protocol.getString());
} }
catch (LdapInvalidAttributeValueException e) { catch (LdapInvalidAttributeValueException e) {
logger.error("Invalid value of the protocol entry.", e.getMessage()); logger.error("Invalid value of the protocol entry: {}",
e.getMessage());
logger.debug("LDAP exception when getting protocol value.", e);
return null; return null;
} }
@@ -179,7 +183,10 @@ public class ConnectionService {
parameter = parameterAttribute.getString(); parameter = parameterAttribute.getString();
} }
catch (LdapInvalidAttributeValueException e) { catch (LdapInvalidAttributeValueException e) {
logger.warn("Parameter value not valid for {}", cnName, e); logger.warn("Parameter value not valid for {}: {}",
cnName, e.getMessage());
logger.debug("LDAP exception when getting parameter value.",
e);
return null; return null;
} }
parameterAttribute.remove(parameter); parameterAttribute.remove(parameter);

View File

@@ -228,7 +228,9 @@ public class UserGroupService {
+ "and will be ignored.", entry.getDn().toString()); + "and will be ignored.", entry.getDn().toString());
} }
catch (LdapInvalidAttributeValueException e) { catch (LdapInvalidAttributeValueException e) {
logger.debug("User group missing identifier.", e.getMessage()); logger.error("User group missing identifier: {}",
e.getMessage());
logger.debug("LDAP exception while getting group identifier.", e);
} }
}); });