diff options
| author | Tim Costen <tim.costen@isode.com> | 2019-10-29 10:25:18 (GMT) |
|---|---|---|
| committer | Kevin Smith <kevin.smith@isode.com> | 2019-10-29 11:52:59 (GMT) |
| commit | 943f4cd11f35573e1af91be578cd058fac34b670 (patch) | |
| tree | 37c14ab65bf2eb3f965f34f5a3b7207c41d41553 | |
| parent | be7632881677da5267eb711c1f2823ac82d43d09 (diff) | |
| download | swift-943f4cd11f35573e1af91be578cd058fac34b670.zip swift-943f4cd11f35573e1af91be578cd058fac34b670.tar.bz2 | |
Comment out logging calls
Swift OpenSSLContext and OpenSSLCertificate contain a number
of error, warning and info logging calls which have the effect
of writing to stderr. This patch comments them out for now -
a proper interface with a logging object being passed in etc
will be added at a later date.
JIRA: SWIFT-426
Bug:
Release-notes:
Manual:
Test-information:
Compiles OK.
TLSTest runs OK.
Change-Id: I2bc09ff32277c2b669317fcf9748358b2934db7c
| -rw-r--r-- | Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp | 2 | ||||
| -rw-r--r-- | Swiften/TLS/OpenSSL/OpenSSLContext.cpp | 32 |
2 files changed, 17 insertions, 17 deletions
diff --git a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp index bb51428..16b0b2b 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp +++ b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp | |||
| @@ -32,7 +32,7 @@ OpenSSLCertificate::OpenSSLCertificate(const ByteArray& der) { | |||
| 32 | #endif | 32 | #endif |
| 33 | cert = std::shared_ptr<X509>(d2i_X509(nullptr, &p, der.size()), X509_free); | 33 | cert = std::shared_ptr<X509>(d2i_X509(nullptr, &p, der.size()), X509_free); |
| 34 | if (!cert) { | 34 | if (!cert) { |
| 35 | SWIFT_LOG(warning) << "Error creating certificate from DER data" << std::endl; | 35 | // SWIFT_LOG(warning) << "Error creating certificate from DER data" << std::endl; |
| 36 | } | 36 | } |
| 37 | parse(); | 37 | parse(); |
| 38 | } | 38 | } |
diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp index b7cf178..7034733 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp +++ b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp | |||
| @@ -207,7 +207,7 @@ static int certVerifyCallback(X509_STORE_CTX* store_ctx, void* arg) | |||
| 207 | if (cb != nullptr) { | 207 | if (cb != nullptr) { |
| 208 | ret = cb(static_cast<const OpenSSLContext*>(context)); | 208 | ret = cb(static_cast<const OpenSSLContext*>(context)); |
| 209 | } else { | 209 | } else { |
| 210 | SWIFT_LOG(warning) << "certVerifyCallback called but context.verifyCertCallback is unset" << std::endl; | 210 | //SWIFT_LOG(warning) << "certVerifyCallback called but context.verifyCertCallback is unset" << std::endl; |
| 211 | ret = 0; | 211 | ret = 0; |
| 212 | } | 212 | } |
| 213 | 213 | ||
| @@ -250,12 +250,12 @@ static int verifyCallback(int preverifyOk, X509_STORE_CTX* ctx) | |||
| 250 | SSL* ssl = static_cast<SSL*>(X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx())); | 250 | SSL* ssl = static_cast<SSL*>(X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx())); |
| 251 | SSL_CTX* sslctx = ssl ? SSL_get_SSL_CTX(ssl) : nullptr; | 251 | SSL_CTX* sslctx = ssl ? SSL_get_SSL_CTX(ssl) : nullptr; |
| 252 | if (!sslctx) { | 252 | if (!sslctx) { |
| 253 | SWIFT_LOG(error) << "verifyCallback: internal error" << std::endl; | 253 | //SWIFT_LOG(error) << "verifyCallback: internal error" << std::endl; |
| 254 | return preverifyOk; | 254 | return preverifyOk; |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | if (SSL_CTX_get_verify_mode(sslctx) == SSL_VERIFY_NONE) { | 257 | if (SSL_CTX_get_verify_mode(sslctx) == SSL_VERIFY_NONE) { |
| 258 | SWIFT_LOG(info) << "verifyCallback: no verification required" << std::endl; | 258 | //SWIFT_LOG(info) << "verifyCallback: no verification required" << std::endl; |
| 259 | // No verification requested | 259 | // No verification requested |
| 260 | return 1; | 260 | return 1; |
| 261 | } | 261 | } |
| @@ -286,12 +286,12 @@ static int verifyCallback(int preverifyOk, X509_STORE_CTX* ctx) | |||
| 286 | X509_NAME* issuerName = X509_get_issuer_name(errCert); | 286 | X509_NAME* issuerName = X509_get_issuer_name(errCert); |
| 287 | issuerString = X509_NAME_to_text(issuerName); | 287 | issuerString = X509_NAME_to_text(issuerName); |
| 288 | } | 288 | } |
| 289 | SWIFT_LOG(error) << "verifyCallback: verification error " << | 289 | // SWIFT_LOG(error) << "verifyCallback: verification error " << |
| 290 | X509_verify_cert_error_string(err) << " depth: " << | 290 | // X509_verify_cert_error_string(err) << " depth: " << |
| 291 | depth << " issuer: " << ((issuerString.length() > 0) ? issuerString : "<unknown>") << std::endl; | 291 | // depth << " issuer: " << ((issuerString.length() > 0) ? issuerString : "<unknown>") << std::endl; |
| 292 | } else { | 292 | // } else { |
| 293 | SWIFT_LOG(info) << "verifyCallback: SSL depth: " << depth << " Subject: " << | 293 | // SWIFT_LOG(info) << "verifyCallback: SSL depth: " << depth << " Subject: " << |
| 294 | ((subjectString.length() > 0) ? subjectString : "<>") << std::endl; | 294 | // ((subjectString.length() > 0) ? subjectString : "<>") << std::endl; |
| 295 | } | 295 | } |
| 296 | // Always return "OK", as check on verification status | 296 | // Always return "OK", as check on verification status |
| 297 | // will be performed once TLS handshake has completed, | 297 | // will be performed once TLS handshake has completed, |
| @@ -305,7 +305,7 @@ bool OpenSSLContext::configure(const TLSOptions &options) | |||
| 305 | if (options.cipherSuites) { | 305 | if (options.cipherSuites) { |
| 306 | std::string cipherSuites = *(options.cipherSuites); | 306 | std::string cipherSuites = *(options.cipherSuites); |
| 307 | if (SSL_CTX_set_cipher_list(context_.get(), cipherSuites.c_str()) != 1 ) { | 307 | if (SSL_CTX_set_cipher_list(context_.get(), cipherSuites.c_str()) != 1 ) { |
| 308 | SWIFT_LOG(error) << "Failed to set cipher-suites" << std::endl; | 308 | // SWIFT_LOG(error) << "Failed to set cipher-suites" << std::endl; |
| 309 | return false; | 309 | return false; |
| 310 | } | 310 | } |
| 311 | } | 311 | } |
| @@ -316,7 +316,7 @@ bool OpenSSLContext::configure(const TLSOptions &options) | |||
| 316 | if (SSL_CTX_set_session_id_context(context_.get(), | 316 | if (SSL_CTX_set_session_id_context(context_.get(), |
| 317 | reinterpret_cast<const unsigned char *>(contextId.c_str()), | 317 | reinterpret_cast<const unsigned char *>(contextId.c_str()), |
| 318 | contextId.length()) != 1) { | 318 | contextId.length()) != 1) { |
| 319 | SWIFT_LOG(error) << "Failed to set context-id" << std::endl; | 319 | // SWIFT_LOG(error) << "Failed to set context-id" << std::endl; |
| 320 | return false; | 320 | return false; |
| 321 | } | 321 | } |
| 322 | } | 322 | } |
| @@ -324,12 +324,12 @@ bool OpenSSLContext::configure(const TLSOptions &options) | |||
| 324 | if (options.sessionCacheTimeout) { | 324 | if (options.sessionCacheTimeout) { |
| 325 | int scto = *options.sessionCacheTimeout; | 325 | int scto = *options.sessionCacheTimeout; |
| 326 | if (scto <= 0) { | 326 | if (scto <= 0) { |
| 327 | SWIFT_LOG(error) << "Invalid value for session-cache-timeout" << std::endl; | 327 | // SWIFT_LOG(error) << "Invalid value for session-cache-timeout" << std::endl; |
| 328 | return false; | 328 | return false; |
| 329 | } | 329 | } |
| 330 | (void)SSL_CTX_set_timeout(context_.get(), scto); | 330 | (void)SSL_CTX_set_timeout(context_.get(), scto); |
| 331 | if (SSL_CTX_get_timeout(context_.get()) != scto) { | 331 | if (SSL_CTX_get_timeout(context_.get()) != scto) { |
| 332 | SWIFT_LOG(error) << "Failed to set session-cache-timeout" << std::endl; | 332 | // SWIFT_LOG(error) << "Failed to set session-cache-timeout" << std::endl; |
| 333 | return false; | 333 | return false; |
| 334 | } | 334 | } |
| 335 | } | 335 | } |
| @@ -371,7 +371,7 @@ bool OpenSSLContext::configure(const TLSOptions &options) | |||
| 371 | if (options.verifyDepth) { | 371 | if (options.verifyDepth) { |
| 372 | int depth = *options.verifyDepth; | 372 | int depth = *options.verifyDepth; |
| 373 | if (depth <= 0) { | 373 | if (depth <= 0) { |
| 374 | SWIFT_LOG(error) << "Invalid value for verify-depth" << std::endl; | 374 | // SWIFT_LOG(error) << "Invalid value for verify-depth" << std::endl; |
| 375 | return false; | 375 | return false; |
| 376 | } | 376 | } |
| 377 | 377 | ||
| @@ -593,7 +593,7 @@ void OpenSSLContext::sendPendingDataToApplication() { | |||
| 593 | 593 | ||
| 594 | bool OpenSSLContext::setCertificateChain(const std::vector<std::shared_ptr<Certificate>>& certificateChain) { | 594 | bool OpenSSLContext::setCertificateChain(const std::vector<std::shared_ptr<Certificate>>& certificateChain) { |
| 595 | if (certificateChain.size() == 0) { | 595 | if (certificateChain.size() == 0) { |
| 596 | SWIFT_LOG(warning) << "Trying to load empty certificate chain." << std::endl; | 596 | // SWIFT_LOG(warning) << "Trying to load empty certificate chain." << std::endl; |
| 597 | return false; | 597 | return false; |
| 598 | } | 598 | } |
| 599 | 599 | ||
| @@ -616,7 +616,7 @@ bool OpenSSLContext::setCertificateChain(const std::vector<std::shared_ptr<Certi | |||
| 616 | } | 616 | } |
| 617 | 617 | ||
| 618 | if (SSL_CTX_add_extra_chain_cert(context_.get(), openSSLCert->getInternalX509().get()) != 1) { | 618 | if (SSL_CTX_add_extra_chain_cert(context_.get(), openSSLCert->getInternalX509().get()) != 1) { |
| 619 | SWIFT_LOG(warning) << "Trying to load empty certificate chain." << std::endl; | 619 | // SWIFT_LOG(warning) << "Trying to load empty certificate chain." << std::endl; |
| 620 | return false; | 620 | return false; |
| 621 | } | 621 | } |
| 622 | // Have to manually increment reference count as SSL_CTX_add_extra_chain_cert does not do so | 622 | // Have to manually increment reference count as SSL_CTX_add_extra_chain_cert does not do so |
Swift