From 54fea4afcf38a28e074e12b4e092ec94b3251c11 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Wed, 12 Nov 2025 14:53:25 +0100 Subject: [PATCH] Minor improvements. * Add new TLS policy `direct` as a replacement for `legacy`. * Document that `/[command]?` prints the help of a command. * Add option to get help via `/command help`. * Fix `my-prof.supp` generation and tests for out-of-source builds. Signed-off-by: Steffen Jaeckel --- Makefile.am | 4 +- src/command/cmd_ac.c | 3 +- src/command/cmd_defs.c | 20 +++++--- src/command/cmd_funcs.c | 102 ++++++++++------------------------------ src/common.c | 61 ++++++++++++++++++++++++ src/common.h | 3 ++ src/config/accounts.c | 2 +- src/config/cafile.c | 3 +- src/otr/otr.c | 6 +-- src/ui/console.c | 1 + src/xmpp/connection.c | 2 +- 11 files changed, 111 insertions(+), 96 deletions(-) diff --git a/Makefile.am b/Makefile.am index afcc735e..c7ddb38e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -285,7 +285,7 @@ endif TESTS = tests/unittests/unittests check_PROGRAMS = tests/unittests/unittests -tests_unittests_unittests_CPPFLAGS = -Itests/ +tests_unittests_unittests_CPPFLAGS = -I$(srcdir)/tests/ tests_unittests_unittests_SOURCES = $(unittest_sources) tests_unittests_unittests_LDADD = -lcmocka @@ -348,7 +348,7 @@ endif .PHONY: my-prof.supp my-prof.supp: - @sed '/^# AUTO-GENERATED START/q' prof.supp > $@ + @sed '/^# AUTO-GENERATED START/q' $(srcdir)/prof.supp > $@ @printf "\n\n# glib\n" >> $@ @cat /usr/share/glib-2.0/valgrind/glib.supp >> $@ @printf "\n\n# Python\n" >> $@ diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 036782b9..d353abcf 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -853,8 +853,9 @@ cmd_ac_init(void) autocomplete_add(tls_property_ac, "force"); autocomplete_add(tls_property_ac, "allow"); autocomplete_add(tls_property_ac, "trust"); - autocomplete_add(tls_property_ac, "legacy"); + autocomplete_add(tls_property_ac, "direct"); autocomplete_add(tls_property_ac, "disable"); + autocomplete_add(tls_property_ac, "legacy"); autocomplete_add(auth_property_ac, "default"); autocomplete_add(auth_property_ac, "legacy"); diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index 026bb100..f864f38d 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -105,6 +105,9 @@ static gboolean _cmd_has_tag(Command* pcmd, const char* const tag); * Command list */ +#define CMD_TLS_DIRECT "Use direct TLS for the connection. It means TLS handshake is started right after TCP connection is established." +#define CMD_TLS_LEGACY "Alternative keyword for 'direct', which was created when one still thought that 'STARTTLS' is the future." + // clang-format off static const struct cmd_t command_defs[] = { { CMD_PREAMBLE("/help", @@ -146,7 +149,7 @@ static const struct cmd_t command_defs[] = { CMD_TAG_CONNECTION) CMD_SYN( "/connect []", - "/connect [server ] [port ] [tls force|allow|trust|legacy|disable] [auth default|legacy]", + "/connect [server ] [port ] [tls force|allow|trust|direct|disable|legacy] [auth default|legacy]", "/connect ") CMD_DESC( "Login to a chat service. " @@ -161,8 +164,9 @@ static const struct cmd_t command_defs[] = { { "tls force", "Force TLS connection, and fail if one cannot be established, this is default behaviour." }, { "tls allow", "Use TLS for the connection if it is available." }, { "tls trust", "Force TLS connection and trust server's certificate." }, - { "tls legacy", "Use legacy TLS for the connection. It means server doesn't support STARTTLS and TLS is forced just after TCP connection is established." }, + { "tls direct", CMD_TLS_DIRECT }, { "tls disable", "Disable TLS for the connection." }, + { "tls legacy", CMD_TLS_LEGACY }, { "auth default", "Default authentication process." }, { "auth legacy", "Allow legacy authentication." }) CMD_EXAMPLES( @@ -2070,7 +2074,7 @@ static const struct cmd_t command_defs[] = { "/account set pgpkeyid ", "/account set startscript