From fa9449fc7367c16e810785b63acbb9edef21e745 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 24 Apr 2012 16:27:23 +0200 Subject: [PATCH] SSL bugfixes. --- base/tlsclient.cpp | 11 ++++++++--- base/tlsclient.h | 1 + icinga-app/icinga.conf | 4 ++-- icinga/jsonrpcendpoint.cpp | 8 ++++++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/base/tlsclient.cpp b/base/tlsclient.cpp index d8984e508..f51360ce0 100644 --- a/base/tlsclient.cpp +++ b/base/tlsclient.cpp @@ -116,14 +116,19 @@ int TLSClient::WritableEventHandler(const EventArgs& ea) return 0; } +bool TLSClient::WantsToRead(void) const +{ + if (SSL_want_read(m_SSL.get())) + return true; + + return TCPClient::WantsToWrite(); +} + bool TLSClient::WantsToWrite(void) const { if (SSL_want_write(m_SSL.get())) return true; - if (SSL_state(m_SSL.get()) != SSL_ST_OK) - return false; - return TCPClient::WantsToWrite(); } diff --git a/base/tlsclient.h b/base/tlsclient.h index e441293c6..5614f27e7 100644 --- a/base/tlsclient.h +++ b/base/tlsclient.h @@ -40,6 +40,7 @@ public: virtual void Start(void); + virtual bool WantsToRead(void) const; virtual bool WantsToWrite(void) const; Event OnVerifyCertificate; diff --git a/icinga-app/icinga.conf b/icinga-app/icinga.conf index 6af0fa60f..38d761f35 100644 --- a/icinga-app/icinga.conf +++ b/icinga-app/icinga.conf @@ -3,8 +3,8 @@ "configrpc": { "replicate": "0", "configSource": "1" }, "demo": { "replicate": "0" } }, - "rpclistener": { - "kekslistener": { "replicate": "0", "port": "7777" } + "rpcconnection": { + "kekslistener": { "replicate": "0", "hostname": "10.0.10.14", "port": "7777" } }, "host": { "localhost": { "ipaddr": "127.0.0.1" } diff --git a/icinga/jsonrpcendpoint.cpp b/icinga/jsonrpcendpoint.cpp index 63590f8b4..9a51fde28 100644 --- a/icinga/jsonrpcendpoint.cpp +++ b/icinga/jsonrpcendpoint.cpp @@ -189,8 +189,12 @@ int JsonRpcEndpoint::ClientReconnectHandler(const TimerEventArgs& ea) int JsonRpcEndpoint::VerifyCertificateHandler(const VerifyCertificateEventArgs& ea) { - if (ea.Certificate && ea.ValidCertificate) - SetIdentity(Utility::GetCertificateCN(ea.Certificate)); + if (ea.Certificate && ea.ValidCertificate) { + string identity = Utility::GetCertificateCN(ea.Certificate); + + if (GetIdentity().empty() && !identity.empty()) + SetIdentity(identity); + } return 0; } -- 2.40.0