diff options
author | James Booth <boothj5@gmail.com> | 2015-09-24 01:06:53 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-09-24 01:06:53 +0100 |
commit | bd421853897b432a2877da549eb7dbc4a67503e3 (patch) | |
tree | 2eadef99ee2223c6ee56c42c8592046aa24d7efa /src/command | |
parent | 8d2c7f1ac0b5e772310b1bb7f324a91bbf8b3805 (diff) | |
download | profani-tty-bd421853897b432a2877da549eb7dbc4a67503e3.tar.gz |
Added /tls revoke
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 12 | ||||
-rw-r--r-- | src/command/commands.c | 14 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/command/command.c b/src/command/command.c index bb440bbf..f2883efc 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -50,6 +50,7 @@ #include "config/accounts.h" #include "config/preferences.h" #include "config/theme.h" +#include "config/tlscerts.h" #include "contact.h" #include "roster_list.h" #include "jid.h" @@ -196,6 +197,7 @@ static struct cmd_t command_defs[] = "/tls always", "/tls deny", "/tls trusted", + "/tls revoke <fingerprint>", "/tls certpath", "/tls certpath set <path>", "/tls certpath clear") @@ -205,7 +207,8 @@ static struct cmd_t command_defs[] = { "allow", "Allow connection to continue with an invalid TLS certificate." }, { "always", "Always allow connections with this invalid TLS certificate." }, { "deny", "Terminate TLS connection." }, - { "trusted", "List manually trusted certificates." }, + { "trusted", "List manually trusted certificates (with /tls always)." }, + { "revoke", "Remove a manually trusted certificate." }, { "certpath", "Show the trusted certificate path." }, { "certpath set <path>", "Specify filesystem path containing trusted certificates." }, { "certpath clear", "Clear the trusted certificate path." }) @@ -2103,6 +2106,7 @@ cmd_init(void) autocomplete_add(tls_ac, "always"); autocomplete_add(tls_ac, "deny"); autocomplete_add(tls_ac, "trusted"); + autocomplete_add(tls_ac, "revoke"); autocomplete_add(tls_ac, "certpath"); tls_certpath_ac = autocomplete_new(); @@ -2286,6 +2290,7 @@ cmd_reset_autocomplete(ProfWin *window) muc_invites_reset_ac(); accounts_reset_all_search(); accounts_reset_enabled_search(); + tlscerts_reset_ac(); prefs_reset_boolean_choice(); presence_reset_sub_request_search(); #ifdef HAVE_LIBGPGME @@ -3521,6 +3526,11 @@ _tls_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; + result = autocomplete_param_with_func(input, "/tls revoke", tlscerts_complete); + if (result) { + return result; + } + result = autocomplete_param_with_ac(input, "/tls certpath", tls_certpath_ac, TRUE); if (result) { return result; diff --git a/src/command/commands.c b/src/command/commands.c index 94734563..3f695cc1 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -198,6 +198,8 @@ cmd_tls(ProfWin *window, const char * const command, gchar **args) if (curr) { cons_show("Trusted certificates:"); cons_show(""); + } else { + cons_show("No trustes certificates found."); } while (curr) { TLSCertificate *cert = curr->data; @@ -224,6 +226,18 @@ cmd_tls(ProfWin *window, const char * const command, gchar **args) } g_list_free_full(certs, (GDestroyNotify)tlscerts_free); return TRUE; + } else if (g_strcmp0(args[0], "revoke") == 0) { + if (args[1] == NULL) { + cons_bad_cmd_usage(command); + } else { + gboolean res = tlscerts_revoke(args[1]); + if (res) { + cons_show("Trusted certificate revoked: %s", args[1]); + } else { + cons_show("Could not find certificate: %s", args[0]); + } + } + return TRUE; } else { cons_bad_cmd_usage(command); return TRUE; |