Skip to content

Commit

Permalink
Enhance ssl log
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelortmann committed Jun 10, 2024
1 parent d58f563 commit d0b8856
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,12 @@ int sockread(char *s, int *len, sock_list *slist, int slistmax, int tclonly)
{
if (slist[i].ssl) {
x = SSL_read(slist[i].ssl, s, grab);
if (x < 0) {
if (!x && (SSL_get_shutdown(slist[i].ssl) == SSL_RECEIVED_SHUTDOWN)) {
*len = slist[i].sock;
slist[i].flags &= ~SOCK_CONNECT;
debug1("net: SSL_read(): received shutdown sock %i", slist[i].sock);
return -1;
} else if (x < 0) {
int err = SSL_get_error(slist[i].ssl, x);
if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE)
errno = EAGAIN;
Expand Down
14 changes: 10 additions & 4 deletions src/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ static void ssl_info(const SSL *ssl, int where, int ret)
SSL_alert_desc_string_long(ret));
} else {
/* Ignore close notify warnings */
debug1("Received close notify warning during %s",
debug1("TLS: Received close notify warning during %s",
(where & SSL_CB_READ) ? "read" : "write");
}
} else if (where & SSL_CB_EXIT) {
Expand All @@ -819,10 +819,16 @@ static void ssl_info(const SSL *ssl, int where, int ret)
SSL_state_string_long(ssl));
}
}
} else {
/* Display the state of the engine for debugging purposes */
debug1("TLS: state change: %s", SSL_state_string_long(ssl));
}
/* Display the state of the engine for debugging purposes */
else if (where == SSL_CB_HANDSHAKE_START)
debug1("TLS: handshake start: %s", SSL_state_string_long(ssl));
else if (where == SSL_CB_CONNECT_LOOP)
debug1("TLS: connect loop: %s", SSL_state_string_long(ssl));
else if (where == SSL_CB_ACCEPT_LOOP)
debug1("TLS: accept loop: %s", SSL_state_string_long(ssl));
else
debug1("TLS: state change: %s", SSL_state_string_long(ssl));
}

/* Switch a socket to SSL communication
Expand Down

0 comments on commit d0b8856

Please sign in to comment.