summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Anthony Giusti <kgiusti@apache.org>2013-05-24 15:55:52 +0000
committerKenneth Anthony Giusti <kgiusti@apache.org>2013-05-24 15:55:52 +0000
commit01602f8cf3f7f783b1e1c81275cd2756974a5ca0 (patch)
treed52c0a8492d94059aed457127a43e061ed949d4c
parent8b7d597faf87f01746948637c242c2134631d28f (diff)
downloadqpid-python-01602f8cf3f7f783b1e1c81275cd2756974a5ca0.tar.gz
QPID-4883: merge fix from trunk0.22
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.22@1486100 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/sys/ssl/SslSocket.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/qpid/cpp/src/qpid/sys/ssl/SslSocket.cpp b/qpid/cpp/src/qpid/sys/ssl/SslSocket.cpp
index a328e49c13..a721918f57 100644
--- a/qpid/cpp/src/qpid/sys/ssl/SslSocket.cpp
+++ b/qpid/cpp/src/qpid/sys/ssl/SslSocket.cpp
@@ -336,16 +336,19 @@ std::string SslSocket::getClientAuthId() const
std::string authId;
CERTCertificate* cert = SSL_PeerCertificate(nssSocket);
if (cert) {
- authId = CERT_GetCommonName(&(cert->subject));
- /*
- * The NSS function CERT_GetDomainComponentName only returns
- * the last component of the domain name, so we have to parse
- * the subject manually to extract the full domain.
- */
- std::string domain = getDomainFromSubject(cert->subjectName);
- if (!domain.empty()) {
- authId += DOMAIN_SEPARATOR;
- authId += domain;
+ char *cn = CERT_GetCommonName(&(cert->subject));
+ if (cn) {
+ authId = std::string(cn);
+ /*
+ * The NSS function CERT_GetDomainComponentName only returns
+ * the last component of the domain name, so we have to parse
+ * the subject manually to extract the full domain.
+ */
+ std::string domain = getDomainFromSubject(cert->subjectName);
+ if (!domain.empty()) {
+ authId += DOMAIN_SEPARATOR;
+ authId += domain;
+ }
}
CERT_DestroyCertificate(cert);
}