From de11f8cdc5817fd2ea79886c4899d2fbe04c94c2 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Sun, 16 Jun 2019 19:31:51 +0100 Subject: Log OpenSSL errors properly instead of printing to stderr. --- blabouncer.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'blabouncer.c') diff --git a/blabouncer.c b/blabouncer.c index baf27c6..ff8667a 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -93,9 +93,12 @@ int connecttoircserver(SSL_CTX **serverctx, SSL **server_ssl, int *serversockfd, *server_ssl = SSL_new(*serverctx); SSL_set_fd(*server_ssl, *serversockfd); if (SSL_connect(*server_ssl) == -1) { - ERR_print_errors_fp(stderr); + char* errstr = openssl_error_string(); + debugprint(DEBUG_CRIT, "SSL_connect failed - %s", errstr); + if (errstr != NULL) free(errstr); } else { debugprint(DEBUG_FULL, "SSL_connect() success.\n"); + } debugprint(DEBUG_FULL, "server openssl complete.\n"); } else { @@ -704,8 +707,9 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) { clients[j].ssl = SSL_new(ctx); SSL_set_fd(clients[j].ssl, newfd); if (SSL_accept(clients[j].ssl) <= 0) { - debugprint(DEBUG_CRIT, "SSL_accept failed for fd %d.\n", clients[j].fd); - ERR_print_errors_fp(stderr); + char* errstr = openssl_error_string(); + debugprint(DEBUG_CRIT, "SSL_accept failed for fd %d - %s", clients[j].fd, errstr); + if (errstr != NULL) free(errstr); } else { debugprint(DEBUG_FULL, "SSL_accept succeeded for fd %d.\n", clients[j].fd); } -- cgit v1.2.3