Added log level protection, changed log levels for some logging #4793

This commit is contained in:
Adam Potolsky 2015-06-12 15:07:53 -07:00
parent ad37db13a9
commit afb0e2a2ea
1 changed files with 14 additions and 10 deletions

View File

@ -306,7 +306,9 @@ SecureSocket::secureAccept(int socket)
if (retry == 0) { if (retry == 0) {
m_secureReady = true; m_secureReady = true;
LOG((CLOG_INFO "accepted secure socket")); LOG((CLOG_INFO "accepted secure socket"));
showSecureCipherInfo(); if (CLOG->getFilter() >= kDEBUG1) {
showSecureCipherInfo();
}
showSecureConnectInfo(); showSecureConnectInfo();
return 1; return 1;
} }
@ -365,7 +367,9 @@ SecureSocket::secureConnect(int socket)
return -1; // Fingerprint failed, error return -1; // Fingerprint failed, error
} }
LOG((CLOG_DEBUG2 "connected secure socket")); LOG((CLOG_DEBUG2 "connected secure socket"));
showSecureCipherInfo(); if (CLOG->getFilter() >= kDEBUG1) {
showSecureCipherInfo();
}
showSecureConnectInfo(); showSecureConnectInfo();
return 1; return 1;
} }
@ -642,10 +646,10 @@ SecureSocket::showSecureCipherInfo()
STACK_OF(SSL_CIPHER) * sStack = SSL_get_ciphers(m_ssl->m_ssl); STACK_OF(SSL_CIPHER) * sStack = SSL_get_ciphers(m_ssl->m_ssl);
if (sStack == NULL) { if (sStack == NULL) {
LOG((CLOG_WARN "No ciphers available on server")); LOG((CLOG_DEBUG1 "local cipher list not available"));
} }
else { else {
LOG((CLOG_DEBUG1 "Ciphers available on server:")); LOG((CLOG_DEBUG1 "available local ciphers:"));
showCipherStackDesc(sStack); showCipherStackDesc(sStack);
} }
@ -653,10 +657,10 @@ SecureSocket::showSecureCipherInfo()
// of OpenSSL, it's not visible, need to use SSL_get_client_ciphers() instead // of OpenSSL, it's not visible, need to use SSL_get_client_ciphers() instead
STACK_OF(SSL_CIPHER) * cStack = m_ssl->m_ssl->session->ciphers; STACK_OF(SSL_CIPHER) * cStack = m_ssl->m_ssl->session->ciphers;
if (cStack == NULL) { if (cStack == NULL) {
LOG((CLOG_WARN "No ciphers available from client")); LOG((CLOG_DEBUG1 "remote cipher list not available"));
} }
else { else {
LOG((CLOG_DEBUG1 "Ciphers available on client:")); LOG((CLOG_DEBUG1 "available remote ciphers:"));
showCipherStackDesc(cStack); showCipherStackDesc(cStack);
} }
return; return;
@ -666,10 +670,10 @@ void
SecureSocket::showSecureLibInfo() SecureSocket::showSecureLibInfo()
{ {
LOG((CLOG_INFO "%s",SSLeay_version(SSLEAY_VERSION))); LOG((CLOG_INFO "%s",SSLeay_version(SSLEAY_VERSION)));
LOG((CLOG_DEBUG2 "OpenSSL : %s",SSLeay_version(SSLEAY_CFLAGS))); LOG((CLOG_DEBUG1 "openSSL : %s",SSLeay_version(SSLEAY_CFLAGS)));
LOG((CLOG_DEBUG2 "OpenSSL : %s",SSLeay_version(SSLEAY_BUILT_ON))); LOG((CLOG_DEBUG1 "openSSL : %s",SSLeay_version(SSLEAY_BUILT_ON)));
LOG((CLOG_DEBUG2 "OpenSSL : %s",SSLeay_version(SSLEAY_PLATFORM))); LOG((CLOG_DEBUG1 "openSSL : %s",SSLeay_version(SSLEAY_PLATFORM)));
LOG((CLOG_DEBUG2 "%s",SSLeay_version(SSLEAY_DIR))); LOG((CLOG_DEBUG1 "%s",SSLeay_version(SSLEAY_DIR)));
return; return;
} }