From c196b8ef7ae21de43b0d4ccfb9252ee7d2b47733 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Fri, 19 Mar 2010 22:53:19 +0000 Subject: Added test cases for QPID-2444 and QPID-2446 Modified SSLUtil to handle the case where distinguished name only contains the CN component. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@925469 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/qpid/transport/network/security/ssl/SSLUtil.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'java/common/src/main') diff --git a/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java b/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java index f23d9ae359..130ce04adc 100644 --- a/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java +++ b/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java @@ -28,7 +28,8 @@ public class SSLUtil if (dn.contains("CN=")) { - hostname = dn.substring(3, dn.indexOf(",")); + hostname = dn.substring(3, + dn.indexOf(",") == -1? dn.length(): dn.indexOf(",")); } if (log.isDebugEnabled()) @@ -38,7 +39,8 @@ public class SSLUtil log.debug("Host Name obtained from DN : " + hostname); } - if (hostname != null && !hostname.equalsIgnoreCase(hostnameExpected)) + if (hostname != null && !(hostname.equalsIgnoreCase(hostnameExpected) || + hostname.equalsIgnoreCase(hostnameExpected + ".localdomain"))) { throw new TransportException("SSL hostname verification failed." + " Expected : " + hostnameExpected + -- cgit v1.2.1