From 79b406da2cc03883eb2da6c8c69ff2d7a9356df9 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Mon, 28 Apr 2014 23:01:30 +0300 Subject: [PATCH] irssi: better public key print out When verifying public key show more information about it. --- apps/irssi/src/silc/core/client_ops.c | 45 ++++++++++++++++++++++++--- apps/irssi/src/silc/core/clientutil.c | 5 +-- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/apps/irssi/src/silc/core/client_ops.c b/apps/irssi/src/silc/core/client_ops.c index 41ace322..0b039649 100644 --- a/apps/irssi/src/silc/core/client_ops.c +++ b/apps/irssi/src/silc/core/client_ops.c @@ -2599,6 +2599,14 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn, silc_pubkey->identifier.realname, silc_pubkey->identifier.email ? silc_pubkey->identifier.email : ""); + else if (conn_type == SILC_CONN_CLIENT && + (silc_pubkey->identifier.realname || + silc_pubkey->identifier.email)) + printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, + SILCTXT_PUBKEY_RECEIVED_CLIENT, "", + silc_pubkey->identifier.realname, + silc_pubkey->identifier.email ? + silc_pubkey->identifier.email : ""); printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, SILCTXT_PUBKEY_FINGERPRINT, entity, fingerprint); printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, @@ -2606,7 +2614,8 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn, format = format_get_text("fe-common/silc", NULL, NULL, NULL, SILCTXT_PUBKEY_ACCEPT); silc_keyboard_entry_redirect(verify_public_key_completion, - format, 0, verify, &server->prompt_op); + format, 0, verify, + server ? &server->prompt_op : NULL); g_free(format); silc_free(fingerprint); silc_free(babbleprint); @@ -2630,6 +2639,14 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn, silc_pubkey->identifier.realname, silc_pubkey->identifier.email ? silc_pubkey->identifier.email : ""); + else if (conn_type == SILC_CONN_CLIENT && + (silc_pubkey->identifier.realname || + silc_pubkey->identifier.email)) + printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, + SILCTXT_PUBKEY_RECEIVED_CLIENT, "", + silc_pubkey->identifier.realname, + silc_pubkey->identifier.email ? + silc_pubkey->identifier.email : ""); printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, SILCTXT_PUBKEY_FINGERPRINT, entity, fingerprint); printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, @@ -2639,7 +2656,9 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn, format = format_get_text("fe-common/silc", NULL, NULL, NULL, SILCTXT_PUBKEY_ACCEPT_ANYWAY); silc_keyboard_entry_redirect(verify_public_key_completion, - format, 0, verify, &server->prompt_op); + format, 0, verify, + server ? &server->prompt_op : NULL); + g_free(format); silc_free(fingerprint); silc_free(babbleprint); @@ -2660,6 +2679,14 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn, silc_pubkey->identifier.realname, silc_pubkey->identifier.email ? silc_pubkey->identifier.email : ""); + else if (conn_type == SILC_CONN_CLIENT && + (silc_pubkey->identifier.realname || + silc_pubkey->identifier.email)) + printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, + SILCTXT_PUBKEY_RECEIVED_CLIENT, "", + silc_pubkey->identifier.realname, + silc_pubkey->identifier.email ? + silc_pubkey->identifier.email : ""); printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, SILCTXT_PUBKEY_FINGERPRINT, entity, fingerprint); printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, @@ -2669,7 +2696,8 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn, format = format_get_text("fe-common/silc", NULL, NULL, NULL, SILCTXT_PUBKEY_ACCEPT_ANYWAY); silc_keyboard_entry_redirect(verify_public_key_completion, - format, 0, verify, &server->prompt_op); + format, 0, verify, + server ? &server->prompt_op : NULL); g_free(format); silc_free(fingerprint); silc_free(babbleprint); @@ -2690,6 +2718,14 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn, silc_pubkey->identifier.realname, silc_pubkey->identifier.email ? silc_pubkey->identifier.email : ""); + else if (conn_type == SILC_CONN_CLIENT && + (silc_pubkey->identifier.realname || + silc_pubkey->identifier.email)) + printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, + SILCTXT_PUBKEY_RECEIVED_CLIENT, "", + silc_pubkey->identifier.realname, + silc_pubkey->identifier.email ? + silc_pubkey->identifier.email : ""); printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, SILCTXT_PUBKEY_FINGERPRINT, entity, fingerprint); printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, @@ -2705,7 +2741,8 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn, format = format_get_text("fe-common/silc", NULL, NULL, NULL, SILCTXT_PUBKEY_ACCEPT_ANYWAY); silc_keyboard_entry_redirect(verify_public_key_completion, - format, 0, verify, &server->prompt_op); + format, 0, verify, + server ? &server->prompt_op : NULL); g_free(format); silc_free(fingerprint); silc_free(babbleprint); diff --git a/apps/irssi/src/silc/core/clientutil.c b/apps/irssi/src/silc/core/clientutil.c index 9717d393..a8a1b5b7 100644 --- a/apps/irssi/src/silc/core/clientutil.c +++ b/apps/irssi/src/silc/core/clientutil.c @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2006, 2008 Pekka Riikonen + Copyright (C) 1997 - 2014 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -545,7 +545,8 @@ SilcBool silc_keyboard_entry_redirect(SILC_KEYBOARD_PROMPT_PROC prompt_func, * assuming that it doesn't as there's already many other things that seem * to make this assumption. */ - *async = ctx->async_context; + if (async) + *async = ctx->async_context; /* * All done. Irssi will invoke the callback on this thread at a later point -- 2.24.0