From 0729fa09cdd41eb497bb4542bce0be40b11442c6 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Sat, 3 Feb 2018 23:23:27 -0500 Subject: [PATCH] GUACAMOLE-197: Handle IllegalArgumentException when parsing state string. --- .../auth/radius/AuthenticationProviderService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 bee0433fd..2418c8ee5 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 @@ -21,6 +21,7 @@ package org.apache.guacamole.auth.radius; import com.google.inject.Inject; import com.google.inject.Provider; +import java.lang.IllegalArgumentException; import java.nio.charset.Charset; import java.util.Arrays; import javax.servlet.http.HttpServletRequest; @@ -161,7 +162,7 @@ public class AuthenticationProviderService { 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); + throw new GuacamoleInvalidCredentialsException("Authentication error.", CredentialsInfo.USERNAME_PASSWORD); } byte[] stateBytes = DatatypeConverter.parseHexBinary(stateString); @@ -169,6 +170,11 @@ public class AuthenticationProviderService { challengeResponse, stateBytes); } + catch (IllegalArgumentException e) { + logger.error("Illegal argument while parsing RADIUS state string.", e.getMessage()); + logger.debug("Illegal argument found while parsing the RADIUS state string.", e); + throw new GuacamoleInvalidCredentialsException("Authentication error.", CredentialsInfo.USERNAME_PASSWORD); + } catch (GuacamoleException e) { logger.error("Cannot configure RADIUS server: {}", e.getMessage()); logger.debug("Error configuring RADIUS server.", e);