Discussion:
[omniORB] two bugs in sslConnection.cc
Wei Jiang
2009-04-23 11:28:10 UTC
Permalink
Index: src/lib/omniORB/orbcore/ssl/sslConnection.cc
===================================================================
RCS file: /cvsroot/omniorb/omni/src/lib/omniORB/orbcore/ssl/Attic/sslConnection.cc,v
retrieving revision 1.1.4.9
diff -u -r1.1.4.9 sslConnection.cc
--- src/lib/omniORB/orbcore/ssl/sslConnection.cc 9 Oct 2006 13:08:58
-0000 1.1.4.9
+++ src/lib/omniORB/orbcore/ssl/sslConnection.cc 23 Apr 2009 05:21:48 -0000
@@ -377,15 +377,19 @@
X509 *peer_cert = SSL_get_peer_certificate(pd_ssl);

if (peer_cert) {
- if (SSL_get_verify_result(pd_ssl) != X509_V_OK)
+ if (SSL_get_verify_result(pd_ssl) != X509_V_OK) {
+ X509_free(peer_cert);
return;
+ }

char buf[1024];
+ X509_NAME * subj = X509_get_subject_name (peer_cert);

- X509_NAME_get_text_by_NID(X509_get_subject_name(peer_cert),
- NID_commonName, buf, sizeof(buf));
+ if (subj && X509_NAME_get_text_by_NID(subj,
+ NID_commonName,buf,sizeof(buf)) > 0) {
+ pd_peeridentity = CORBA::string_dup(buf);
+ }

- pd_peeridentity = CORBA::string_dup(buf);
X509_free(peer_cert);
}
}
--
***@sduept.com not work
Loading...