activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject git commit: https://issues.apache.org/jira/browse/AMQCPP-530
Date Thu, 16 Jan 2014 19:41:17 GMT
Updated Branches:
  refs/heads/3.8.x a1c128ee6 -> e4e01986c


https://issues.apache.org/jira/browse/AMQCPP-530

Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/e4e01986
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/e4e01986
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/e4e01986

Branch: refs/heads/3.8.x
Commit: e4e01986ce60531091629b03f6a15693fe8647c1
Parents: a1c128e
Author: Timothy Bish <tabish121@gmai.com>
Authored: Thu Jan 16 14:41:15 2014 -0500
Committer: Timothy Bish <tabish121@gmai.com>
Committed: Thu Jan 16 14:41:15 2014 -0500

----------------------------------------------------------------------
 .../internal/net/ssl/openssl/OpenSSLSocket.cpp  | 22 +++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/e4e01986/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp b/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp
index e52f8e3..aedd2d4 100644
--- a/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp
+++ b/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp
@@ -684,13 +684,21 @@ void OpenSSLSocket::verifyServerCert(const std::string& serverName)
{
     }
 
     X509_NAME* subject = X509_get_subject_name(cert);
-    char buffer[256];
-
-    if (subject != NULL && X509_NAME_get_text_by_NID(subject, NID_commonName, buffer,
256) > 0) {
-        buffer[255] = 0;
-        if (StringUtils::compare(buffer, serverName.c_str()) == 0) {
-            return;
-        }
+    X509_NAME_ENTRY *entry;
+    int lastpos = -1;
+
+    if (subject != NULL) {
+       for (;;) {
+           lastpos = X509_NAME_get_index_by_NID(subject, NID_commonName, lastpos);
+           if (lastpos == -1) {
+               break;
+           }
+           entry = X509_NAME_get_entry(subject, lastpos);
+           const char * entryText = (const char *) ASN1_STRING_data(X509_NAME_ENTRY_get_data(entry));
+            if (StringUtils::compare(entryText , serverName.c_str()) == 0) {
+                return;
+            }
+       }
     }
 
     // We got here so no match to serverName in the Certificate


Mime
View raw message