commit af0a0195b419a2146fd2a6afc4b95906a855f9e3
parent 19437612b2a89d0949bcdef4ac9210f06270f0c1
Author: hhvn <dev@hhvn.uk>
Date: Thu, 21 Apr 2022 20:01:47 +0100
Split SELF_TLS_NAMES into multiple commands
Diffstat:
3 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/src/config.c b/src/config.c
@@ -308,12 +308,22 @@ struct Config config[] = {
.str = "Protocol: %{b}${2}%{b} (%{b}${3}%{b} bits, %{b}${4}%{b})",
.strhandle = config_redraws,
.description = {
- "TLS version information", NULL}},
- {"format.ui.tls.names", 1, Val_string,
- .str = "SNI name: %{b}${2}%{b}\\nCert subject: %{b}${3}%{b}\\nCert issuer: %{b}${3}%{b}",
+ "TLS version and crypto information.", NULL}},
+ {"format.ui.tls.sni", 1, Val_string,
+ .str = "SNI name: %{b}${2}%{b}",
.strhandle = config_redraws,
.description = {
- "TLS identification", NULL}},
+ "TLS server name indication.", NULL}},
+ {"format.ui.tls.issuer", 1, Val_string,
+ .str = "Cert issuer: %{b}${3}%{b}",
+ .strhandle = config_redraws,
+ .description = {
+ "TLS certificate issuer.", NULL}},
+ {"format.ui.tls.subject", 1, Val_string,
+ .str = "Cert subject: %{b}${3}%{b}",
+ .strhandle = config_redraws,
+ .description = {
+ "TLS certificate subject.", NULL}},
#endif /* TLS */
{"format.ui.keybind", 1, Val_string,
.str = " ${1}: ${2}",
diff --git a/src/format.c b/src/format.c
@@ -38,7 +38,9 @@ struct {
{"SELF_TLSNOTCOMPILED", "format.ui.tls.notcompiled"},
#else
{"SELF_TLS_VERSION", "format.ui.tls.version"},
- {"SELF_TLS_NAMES", "format.ui.tls.names"},
+ {"SELF_TLS_SNI", "format.ui.tls.sni"},
+ {"SELF_TLS_ISSUER", "format.ui.tls.issuer"},
+ {"SELF_TLS_SUBJECT", "format.ui.tls.subject"},
#endif /* TLS */
{"SELF_KEYBIND_START", "format.ui.keybind.start"},
{"SELF_KEYBIND_LIST", "format.ui.keybind"},
diff --git a/src/serv.c b/src/serv.c
@@ -304,15 +304,16 @@ serv_connect(struct Server *server) {
if (tls_peer_cert_provided(server->tls_ctx)) {
hist_format(server->history, Activity_status, HIST_SHOW,
- "SELF_TLS_VERSION %s %s %s %s",
+ "SELF_TLS_VERSION %s %s %d %s",
server->name, tls_conn_version(server->tls_ctx),
tls_conn_cipher_strength(server->tls_ctx),
tls_conn_cipher(server->tls_ctx));
- hist_format(server->history, Activity_status, HIST_SHOW,
- "SELF_TLS_NAMES %s %s %s %s",
- server->name, tls_conn_servername(server->tls_ctx),
- tls_peer_cert_issuer(server->tls_ctx),
- tls_peer_cert_subject(server->tls_ctx));
+ hist_format(server->history, Activity_status, HIST_SHOW, "SELF_TLS_SNI %s :%s",
+ server->name, tls_conn_servername(server->tls_ctx));
+ hist_format(server->history, Activity_status, HIST_SHOW, "SELF_TLS_ISSUER %s :%s",
+ server->name, tls_peer_cert_issuer(server->tls_ctx));
+ hist_format(server->history, Activity_status, HIST_SHOW, "SELF_TLS_SUBJECT %s :%s",
+ server->name, tls_peer_cert_subject(server->tls_ctx));
}
}
#endif /* TLS */