1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-10-27 20:36:18 +00:00

S2S-TLS/GnuTLS: Streamline logging

This commit is contained in:
Alexander Barton 2024-01-05 22:31:32 +01:00
parent 509ff60326
commit 663972c88d

View File

@ -869,8 +869,10 @@ ConnSSL_HandleError(CONNECTION * c, const int code, const char *fname)
default: default:
assert(code < 0); assert(code < 0);
if (gnutls_error_is_fatal(code)) { if (gnutls_error_is_fatal(code)) {
Log(LOG_ERR, "SSL error: %s [%s].", /* We don't need to log this here, the generic
gnutls_strerror(code), fname); * connection layer will take care of it. */
LogDebug("SSL error: %s [%s].",
gnutls_strerror(code), fname);
ConnSSL_Free(c); ConnSSL_Free(c);
return -1; return -1;
} }
@ -914,12 +916,12 @@ LogGnuTLS_CertInfo(int level, gnutls_x509_crt_t cert, const char *msg)
assert(size); assert(size);
issuer_dn = LogMalloc(size); issuer_dn = LogMalloc(size);
if (!issuer_dn) { if (!issuer_dn) {
Log(level, "%s: Distinguished Name: %s", msg, dn); Log(level, "%s: Distinguished Name \"%s\".", msg, dn);
free(dn); free(dn);
return; return;
} }
gnutls_x509_crt_get_issuer_dn(cert, issuer_dn, &size); gnutls_x509_crt_get_issuer_dn(cert, issuer_dn, &size);
Log(level, "%s: Distinguished Name: \"%s\", Issuer \"%s\"", msg, dn, Log(level, "%s: Distinguished Name \"%s\", Issuer \"%s\".", msg, dn,
issuer_dn); issuer_dn);
free(dn); free(dn);
free(issuer_dn); free(issuer_dn);
@ -979,7 +981,7 @@ ConnSSL_LogCertInfo( CONNECTION * c, bool connect)
* hand we want client certificates, for example for * hand we want client certificates, for example for
* "CertFP" authentication with services ... */ * "CertFP" authentication with services ... */
LogOpenSSL_CertInfo(LOG_INFO, peer_cert, LogOpenSSL_CertInfo(LOG_INFO, peer_cert,
"Got unchecked client certificate"); "Got unchecked peer certificate");
} }
X509_free(peer_cert); X509_free(peer_cert);