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 2018/02/05 03:09:25 UTC

[3/8] guacamole-client git commit: GUACAMOLE-197: Deal with null state field..

GUACAMOLE-197: Deal with null state field..


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

Branch: refs/heads/master
Commit: 41dd9fc60dfe27c8e067abb9c2c797c2af49f965
Parents: 77b4665
Author: Nick Couchman <vn...@apache.org>
Authored: Sat Feb 3 23:17:30 2018 -0500
Committer: Nick Couchman <vn...@apache.org>
Committed: Sat Feb 3 23:17:30 2018 -0500

----------------------------------------------------------------------
 .../auth/radius/AuthenticationProviderService.java     | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/41dd9fc6/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java b/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java
index 1ff84c9..bee0433 100644
--- a/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java
+++ b/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java
@@ -157,10 +157,17 @@ public class AuthenticationProviderService {
         // This is a response to a previous challenge, authenticate with that.
         else {
             try {
-                byte[] stateBytes = DatatypeConverter.parseHexBinary(request.getParameter(RadiusStateField.PARAMETER_NAME));
+                String stateString = request.getParameter(RadiusStateField.PARAMETER_NAME);
+                if (stateString == null) {
+                    logger.error("Could not retrieve RADIUS state.");
+                    logger.debug("Received null value while retrieving RADIUS state parameter.");
+                    throws new GuacamoleInvalidCredentialsException("Authentication error.", CredentialsInfo.USERNAME_PASSWORD);
+                }
+
+                byte[] stateBytes = DatatypeConverter.parseHexBinary(stateString);
                 radPack = radiusService.sendChallengeResponse(credentials.getUsername(),
-                                                     challengeResponse,
-                                                     stateBytes);
+                                                              challengeResponse,
+                                                              stateBytes);
             }
             catch (GuacamoleException e) {
                 logger.error("Cannot configure RADIUS server: {}", e.getMessage());