mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-839: Merge corrected handling of possible null values within SSL/TLS client auth support.
This commit is contained in:
@@ -253,7 +253,20 @@ public class SSLClientAuthenticationResource extends SSOResource {
|
|||||||
try (Reader reader = new StringReader(new String(certificate, StandardCharsets.UTF_8))) {
|
try (Reader reader = new StringReader(new String(certificate, StandardCharsets.UTF_8))) {
|
||||||
|
|
||||||
PEMParser parser = new PEMParser(reader);
|
PEMParser parser = new PEMParser(reader);
|
||||||
cert = (X509CertificateHolder) parser.readObject();
|
Object object = parser.readObject();
|
||||||
|
|
||||||
|
// Verify received data is indeed an X.509 certificate
|
||||||
|
if (object == null || !(object instanceof X509CertificateHolder))
|
||||||
|
throw new GuacamoleClientException("Certificate did not "
|
||||||
|
+ "contain an X.509 certificate.");
|
||||||
|
|
||||||
|
// Verify sanity of received certificate (there should be only
|
||||||
|
// one object here)
|
||||||
|
if (parser.readObject() != null)
|
||||||
|
throw new GuacamoleClientException("Certificate contains "
|
||||||
|
+ "more than a single X.509 certificate.");
|
||||||
|
|
||||||
|
cert = (X509CertificateHolder) object;
|
||||||
|
|
||||||
// Verify certificate is valid (it should be given pre-validation
|
// Verify certificate is valid (it should be given pre-validation
|
||||||
// from SSL termination, but it's worth rechecking for sanity)
|
// from SSL termination, but it's worth rechecking for sanity)
|
||||||
|
@@ -45,6 +45,9 @@ public abstract class WildcardURIGuacamoleProperty extends URIGuacamoleProperty
|
|||||||
@Override
|
@Override
|
||||||
public URI parseValue(String value) throws GuacamoleException {
|
public URI parseValue(String value) throws GuacamoleException {
|
||||||
|
|
||||||
|
if (value == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
// Verify wildcard prefix is present
|
// Verify wildcard prefix is present
|
||||||
Matcher matcher = WILDCARD_URI_PATTERN.matcher(value);
|
Matcher matcher = WILDCARD_URI_PATTERN.matcher(value);
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
|
Reference in New Issue
Block a user