1
0
mirror of https://github.com/irssi/irssi.git synced 2025-01-03 14:56:47 -05:00

Shorten the certificate chain output.

This commit is contained in:
Alexander Færøy 2016-10-23 02:51:08 +02:00
parent 322625b548
commit bc4e2c9ade
No known key found for this signature in database
GPG Key ID: E15081D5D3C3DB53
3 changed files with 21 additions and 11 deletions

View File

@ -32,6 +32,7 @@ static void tls_handshake_finished(SERVER_REC *server, TLS_REC *tls)
GSList *certs = NULL;
GSList *subject = NULL;
GSList *issuer = NULL;
GString *str = NULL;
TLS_CERT_ENTRY_REC *data = NULL;
if (! settings_get_bool("tls_verbose_connect"))
@ -41,20 +42,31 @@ static void tls_handshake_finished(SERVER_REC *server, TLS_REC *tls)
for (certs = tls->certs; certs != NULL; certs = certs->next) {
TLS_CERT_REC *tls_cert_rec = certs->data;
printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, TXT_TLS_CERT_SUBJECT_HEADER);
str = g_string_new(NULL);
for (subject = tls_cert_rec->subject; subject != NULL; subject = subject->next) {
data = subject->data;
printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, TXT_TLS_CERT_NAMED_ENTRY, data->name, data->value);
g_string_append_printf(str, "%s: %s, ", data->name, data->value);
}
printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, TXT_TLS_CERT_ISSUER_HEADER);
if (str->len > 1)
g_string_truncate(str, str->len - 2);
printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, TXT_TLS_CERT_SUBJECT, str->str);
g_string_free(str, TRUE);
str = g_string_new(NULL);
for (issuer = tls_cert_rec->issuer; issuer != NULL; issuer = issuer->next) {
data = issuer->data;
printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, TXT_TLS_CERT_NAMED_ENTRY, data->name, data->value);
g_string_append_printf(str, "%s: %s, ", data->name, data->value);
}
if (str->len > 1)
g_string_truncate(str, str->len - 2);
printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, TXT_TLS_CERT_ISSUER, str->str);
g_string_free(str, TRUE);
}
printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, TXT_TLS_PROTOCOL_VERSION, tls->protocol_version, tls->cipher_size, tls->cipher);

View File

@ -298,9 +298,8 @@ FORMAT_REC fecommon_core_formats[] = {
{ "tls_ephemeral_key_unavailable", "EDH Key: {error N/A}", 0 },
{ "tls_pubkey", "Public Key: {hilight $0} bit {hilight $1}, valid from {hilight $2} to {hilight $3}", 4, { 1, 0, 0, 0 } },
{ "tls_cert_header", "Certificate Chain:", 0 },
{ "tls_cert_subject_header", " Subject:", 0 },
{ "tls_cert_issuer_header", " Issuer:", 0 },
{ "tls_cert_named_entry", " $[-2]0: {hilight $1}", 2, { 0, 0 } },
{ "tls_cert_subject", " Subject: {hilight $0}", 1, { 0 } },
{ "tls_cert_issuer", " Issuer: {hilight $0}", 1, { 0 } },
{ "tls_pubkey_fingerprint", "Public Key Fingerprint: {hilight $0} ({hilight $1})", 2, { 0, 0 } },
{ "tls_cert_fingerprint", "Certificate Fingerprint: {hilight $0} ({hilight $1})", 2, { 0, 0 } },
{ "tls_protocol_version", "Protocol: {hilight $0} ({hilight $1} bit, {hilight $2})", 3, { 0, 1, 0 } },

View File

@ -262,9 +262,8 @@ enum {
TXT_TLS_EPHEMERAL_KEY_UNAVAILBLE,
TXT_TLS_PUBKEY,
TXT_TLS_CERT_HEADER,
TXT_TLS_CERT_SUBJECT_HEADER,
TXT_TLS_CERT_ISSUER_HEADER,
TXT_TLS_CERT_NAMED_ENTRY,
TXT_TLS_CERT_SUBJECT,
TXT_TLS_CERT_ISSUER,
TXT_TLS_PUBKEY_FINGERPRINT,
TXT_TLS_CERT_FINGERPRINT,
TXT_TLS_PROTOCOL_VERSION