Skip to content

Commit 5cde716

Browse files
Enhance TLS error logging
Found by: https://github.com/michaelortmann Patch by: https://github.com/michaelortmann
1 parent d13fbc1 commit 5cde716

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/net.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -988,9 +988,14 @@ int sockread(char *s, int *len, sock_list *slist, int slistmax, int tclonly)
988988
debug0("net: sockread(): SSL_read() SSL_ERROR_SYSCALL");
989989
putlog(LOG_MISC, "*", "NET: SSL read failed. Non-SSL connection?");
990990
}
991-
else
992-
debug2("net: sockread(): SSL_read() error = %s (%i)",
993-
ERR_error_string(ERR_get_error(), 0), err);
991+
else {
992+
long err2 = ERR_get_error();
993+
debug3("net: sockread(): SSL_read() error = %s (%i) (%li)",
994+
ERR_error_string(err2, 0), err, err2);
995+
if ((err == SSL_ERROR_SSL) &&
996+
(ERR_GET_REASON(err2) == SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE))
997+
putlog(LOG_MISC, "*", "NET: SSL read failed. Peer did not return a certificate, which is mandatory due to ssl-verify settings.");
998+
}
994999
x = -1;
9951000
}
9961001
} else

0 commit comments

Comments
 (0)