diff options
author | James Booth <boothj5@gmail.com> | 2015-09-22 21:42:05 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-09-22 21:42:05 +0100 |
commit | 9414ad268d79ba3d0e75ef5fbe0e379c4462893d (patch) | |
tree | f588f8375cc70c89b5ce352e33f834985aa79a5a /src/command | |
parent | 74151e6419a606c25b6ea9ad2eed05679f6e8fd9 (diff) | |
download | profani-tty-9414ad268d79ba3d0e75ef5fbe0e379c4462893d.tar.gz |
Prompt user to allow or deny untrusted TLS certificates
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 26 | ||||
-rw-r--r-- | src/command/commands.c | 7 | ||||
-rw-r--r-- | src/command/commands.h | 1 |
3 files changed, 32 insertions, 2 deletions
diff --git a/src/command/command.c b/src/command/command.c index 27c8e078..949f21c7 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -186,6 +186,21 @@ static struct cmd_t command_defs[] = "/connect me@chatty server chatty.com port 5443") }, + { "/tls", + cmd_tls, parse_args, 0, 0, NULL, + CMD_TAGS( + CMD_TAG_CONNECTION) + CMD_SYN( + "/tls allow", + "/tls deny") + CMD_DESC( + "Handle TLS certificates. ") + CMD_ARGS( + { "allow", "Allow connection using invalid TLS certificate." }, + { "deny", "Allow connection using invalid TLS certificate." }) + CMD_NOEXAMPLES + }, + { "/disconnect", cmd_disconnect, parse_args, 0, 0, NULL, CMD_TAGS( @@ -1674,6 +1689,7 @@ static Autocomplete inpblock_ac; static Autocomplete receipts_ac; static Autocomplete pgp_ac; static Autocomplete pgp_log_ac; +static Autocomplete tls_ac; /* * Initialise command autocompleter and history @@ -2069,6 +2085,10 @@ cmd_init(void) autocomplete_add(pgp_log_ac, "on"); autocomplete_add(pgp_log_ac, "off"); autocomplete_add(pgp_log_ac, "redact"); + + tls_ac = autocomplete_new(); + autocomplete_add(tls_ac, "allow"); + autocomplete_add(tls_ac, "deny"); } void @@ -2133,6 +2153,7 @@ cmd_uninit(void) autocomplete_free(receipts_ac); autocomplete_free(pgp_ac); autocomplete_free(pgp_log_ac); + autocomplete_free(tls_ac); } gboolean @@ -2313,6 +2334,7 @@ cmd_reset_autocomplete(ProfWin *window) autocomplete_reset(receipts_ac); autocomplete_reset(pgp_ac); autocomplete_reset(pgp_log_ac); + autocomplete_reset(tls_ac); if (window->type == WIN_CHAT) { ProfChatWin *chatwin = (ProfChatWin*)window; @@ -2525,8 +2547,8 @@ _cmd_complete_parameters(ProfWin *window, const char * const input) } } - gchar *cmds[] = { "/prefs", "/disco", "/close", "/subject", "/room" }; - Autocomplete completers[] = { prefs_ac, disco_ac, close_ac, subject_ac, room_ac }; + gchar *cmds[] = { "/prefs", "/disco", "/close", "/subject", "/room", "/tls" }; + Autocomplete completers[] = { prefs_ac, disco_ac, close_ac, subject_ac, room_ac, tls_ac }; for (i = 0; i < ARRAY_SIZE(cmds); i++) { result = autocomplete_param_with_ac(input, cmds[i], completers[i], TRUE); diff --git a/src/command/commands.c b/src/command/commands.c index 61c0373b..5ec0dd1f 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -157,6 +157,13 @@ cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran) } gboolean +cmd_tls(ProfWin *window, const char * const command, gchar **args) +{ + cons_bad_cmd_usage(command); + return TRUE; +} + +gboolean cmd_connect(ProfWin *window, const char * const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); diff --git a/src/command/commands.h b/src/command/commands.h index 89f923ff..3c1d52c7 100644 --- a/src/command/commands.h +++ b/src/command/commands.h @@ -82,6 +82,7 @@ gboolean cmd_chlog(ProfWin *window, const char * const command, gchar **args); gboolean cmd_clear(ProfWin *window, const char * const command, gchar **args); gboolean cmd_close(ProfWin *window, const char * const command, gchar **args); gboolean cmd_connect(ProfWin *window, const char * const command, gchar **args); +gboolean cmd_tls(ProfWin *window, const char * const command, gchar **args); gboolean cmd_decline(ProfWin *window, const char * const command, gchar **args); gboolean cmd_disco(ProfWin *window, const char * const command, gchar **args); gboolean cmd_disconnect(ProfWin *window, const char * const command, gchar **args); |