summaryrefslogtreecommitdiff
path: root/blabouncer.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-06-16 19:31:51 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-06-16 19:31:51 +0100
commitde11f8cdc5817fd2ea79886c4899d2fbe04c94c2 (patch)
tree4e22b67cd007298bd7b5504c0c7a733893854581 /blabouncer.c
parentdb0ab741a43a56ed898112fa09af6e465272cd25 (diff)
Log OpenSSL errors properly instead of printing to stderr.
Diffstat (limited to 'blabouncer.c')
-rw-r--r--blabouncer.c10
1 files changed, 7 insertions, 3 deletions
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);
}