From: Fabian Keil <fk@fabiankeil.de>
Date: Sat, 3 Oct 2020 11:37:29 +0000 (+0200)
Subject: OpenSSL ssl_send_data(): Include the file descriptor in the log messages
X-Git-Tag: v_3_0_29~55
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/@default-cgi@/faq/static/@default-cgi@toggle?a=commitdiff_plain;h=e1d238273e635876aa141baf24570a1fbb2759cb;p=privoxy.git
OpenSSL ssl_send_data(): Include the file descriptor in the log messages
---
diff --git a/openssl.c b/openssl.c
index 95f0fa46..37b80696 100644
--- a/openssl.c
+++ b/openssl.c
@@ -152,19 +152,27 @@ extern size_t is_ssl_pending(struct ssl_attr *ssl_attr)
extern int ssl_send_data(struct ssl_attr *ssl_attr, const unsigned char *buf, size_t len)
{
BIO *bio = ssl_attr->openssl_attr.bio;
+ SSL *ssl;
int ret = 0;
int pos = 0; /* Position of unsent part in buffer */
+ int fd = -1;
if (len == 0)
{
return 0;
}
+ if (BIO_get_ssl(bio, &ssl) == 1)
+ {
+ fd = SSL_get_fd(ssl);
+ }
+
while (pos < len)
{
int send_len = (int)len - pos;
- log_error(LOG_LEVEL_WRITING, "TLS: %N", send_len, buf+pos);
+ log_error(LOG_LEVEL_WRITING, "TLS on socket %d: %N",
+ fd, send_len, buf+pos);
/*
* Sending one part of the buffer
@@ -176,7 +184,7 @@ extern int ssl_send_data(struct ssl_attr *ssl_attr, const unsigned char *buf, si
if (!BIO_should_retry(bio))
{
log_ssl_errors(LOG_LEVEL_ERROR,
- "Sending data over TLS/SSL failed");
+ "Sending data on socket %d over TLS/SSL failed", fd);
return -1;
}
}