squelch noisy "cert already in hash table" errors

This commit is contained in:
David Rose 2009-10-23 04:40:57 +00:00
parent c015814321
commit c8c51528bd
2 changed files with 32 additions and 3 deletions

View File

@ -184,7 +184,7 @@ load_certificates_from_pem_ram(const char *data, size_t data_size) {
if (itmp->x509) {
int result = X509_STORE_add_cert(_x509_store, itmp->x509);
if (result == 0) {
notify_ssl_errors();
notify_debug_ssl_errors();
} else {
++count;
}
@ -197,7 +197,7 @@ load_certificates_from_pem_ram(const char *data, size_t data_size) {
} else if (itmp->crl) {
int result = X509_STORE_add_crl(_x509_store, itmp->crl);
if (result == 0) {
notify_ssl_errors();
notify_debug_ssl_errors();
} else {
++count;
}
@ -272,7 +272,7 @@ load_certificates_from_der_ram(const char *data, size_t data_size) {
int result = X509_STORE_add_cert(_x509_store, x509);
if (result == 0) {
notify_ssl_errors();
notify_debug_ssl_errors();
} else {
++count;
}
@ -335,6 +335,34 @@ notify_ssl_errors() {
#endif // REPORT_OPENSSL_ERRORS
}
////////////////////////////////////////////////////////////////////
// Function: OpenSSLWrapper::notify_debug_ssl_errors
// Access: Public
// Description: As notify_ssl_errors(), but sends the output to debug
// instead of warning.
////////////////////////////////////////////////////////////////////
void OpenSSLWrapper::
notify_debug_ssl_errors() {
#ifdef REPORT_OPENSSL_ERRORS
static bool strings_loaded = false;
if (!strings_loaded) {
SSL_load_error_strings();
strings_loaded = true;
}
unsigned long e = ERR_get_error();
while (e != 0) {
if (express_cat.is_debug()) {
static const size_t buffer_len = 256;
char buffer[buffer_len];
ERR_error_string_n(e, buffer, buffer_len);
express_cat.debug() << buffer << "\n";
}
e = ERR_get_error();
}
#endif // REPORT_OPENSSL_ERRORS
}
////////////////////////////////////////////////////////////////////
// Function: OpenSSLWrapper::get_global_ptr
// Access: Public, Static

View File

@ -54,6 +54,7 @@ public:
X509_STORE *get_x509_store();
void notify_ssl_errors();
void notify_debug_ssl_errors();
static OpenSSLWrapper *get_global_ptr();