aboutsummaryrefslogtreecommitdiff
path: root/src/IO
diff options
context:
space:
mode:
authorcorvid <devnull@localhost>2016-07-04 01:39:45 +0000
committercorvid <devnull@localhost>2016-07-04 01:39:45 +0000
commit4bdfab5489b4d3eea2436d03913a639b2a0f39ca (patch)
treefb82e043ec85b06e77a930742eb3bef231d63835 /src/IO
parentdc0280859b8aea3c571f746471891c42d44050b5 (diff)
in some TLS MSGs, don't show port if it's the default
Diffstat (limited to 'src/IO')
-rw-r--r--src/IO/tls.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/IO/tls.c b/src/IO/tls.c
index 4ef26789..980e0a53 100644
--- a/src/IO/tls.c
+++ b/src/IO/tls.c
@@ -947,8 +947,10 @@ static void Tls_connect(int fd, int connkey)
const char *version = mbedtls_ssl_get_version(ssl),
*cipher = mbedtls_ssl_get_ciphersuite(ssl);
- MSG("%s:%d %s, cipher %s\n", URL_AUTHORITY(conn->url),
- URL_PORT(conn->url), version, cipher);
+ MSG("%s", URL_AUTHORITY(conn->url));
+ if (URL_PORT(conn->url) != URL_HTTPS_PORT)
+ MSG(":%d", URL_PORT(conn->url));
+ MSG(" %s, cipher %s\n", version, cipher);
}
if (srv->cert_status == CERT_STATUS_USER_ACCEPTED ||
(Tls_examine_certificate(conn->ssl, srv) != -1)) {
@@ -1101,10 +1103,11 @@ void a_Tls_close_by_fd(int fd)
static void Tls_cert_authorities_print_summary()
{
const int ca_len = dList_length(cert_authorities);
+ Dstr *ds = dStr_new("");
int i, j;
if (ca_len)
- MSG("TLS: Trusted during this session:\n");
+ dStr_append(ds, "TLS: Trusted during this session:\n");
for (i = 0; i < ca_len; i++) {
CertAuth_t *ca = (CertAuth_t *)dList_nth_data(cert_authorities, i);
@@ -1118,17 +1121,21 @@ static void Tls_cert_authorities_print_summary()
ca_name += 3;
else
ca_name = ca->name;
- MSG("- %s for: ", ca_name);
+ dStr_sprintfa(ds, "- %s for: ", ca_name);
for (j = 0; j < servers_len; j++) {
Server_t *s = dList_nth_data(ca->servers, j);
bool_t ipv6 = a_Url_host_type(s->hostname) == URL_HOST_IPV6;
- MSG("%s%s%s:%d ", ipv6?"[":"", s->hostname, ipv6?"]":"", s->port);
+ dStr_sprintfa(ds, "%s%s%s", ipv6?"[":"", s->hostname, ipv6?"]":"");
+ if (s->port != URL_HTTPS_PORT)
+ dStr_sprintfa(ds, ":%d", s->port);
+ dStr_append_c(ds, ' ');
}
- MSG("\n");
+ dStr_append_c(ds, '\n');
}
-
+ MSG("%s", ds->str);
+ dStr_free(ds, 1);
}
/*
@@ -1189,7 +1196,8 @@ static void Tls_fd_map_remove_all()
*/
void a_Tls_freeall(void)
{
- Tls_cert_authorities_print_summary();
+ if (prefs.show_msg)
+ Tls_cert_authorities_print_summary();
Tls_fd_map_remove_all();
Tls_cert_authorities_freeall();