From ecafb6deaf19f261d7eb7e0afc1ef8cfa6104f56 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Wed, 27 Apr 2022 16:08:39 +0200 Subject: [PATCH 1/3] Remove comment --- src/command/cmd_funcs.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 15bf5d7c..b398f3c3 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -7503,11 +7503,6 @@ cmd_pgp(ProfWin* window, const char* const command, gchar** args) #ifdef HAVE_LIBGPGME -/*! - * \brief Command for XEP-0373: OpenPGP for XMPP - * - */ - gboolean cmd_ox(ProfWin* window, const char* const command, gchar** args) { From 866f688621313c6996a7a49d520aac12d142fa6c Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Wed, 27 Apr 2022 16:13:05 +0200 Subject: [PATCH 2/3] ox: print bad usage instead of custom message --- src/command/cmd_funcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index b398f3c3..a74f37eb 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -7695,7 +7695,7 @@ cmd_ox(ProfWin* window, const char* const command, gchar** args) cons_show("JID and OpenPGP Key ID are required"); } } else { - cons_show("OX not implemented"); + cons_bad_cmd_usage(command); } return TRUE; } From c8b88733efc8be47ceb3602286755e372acdfa9f Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Wed, 27 Apr 2022 16:17:48 +0200 Subject: [PATCH 3/3] ox: print invalid fingerprint instead of aborting Asserting here is not the right thing to do at all. A person could have a typo in the fingerprint. Or like in the case of the reported bug just confuse the arguments. An additional check for valid jid should be added later to the calling function maybe. Fix https://github.com/profanity-im/profanity/issues/1698 --- src/xmpp/ox.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/xmpp/ox.c b/src/xmpp/ox.c index f43fbd60..0fa5cece 100644 --- a/src/xmpp/ox.c +++ b/src/xmpp/ox.c @@ -340,7 +340,11 @@ _ox_request_public_key(const char* const jid, const char* const fingerprint) { assert(jid); assert(fingerprint); - assert(strlen(fingerprint) == KEYID_LENGTH); + + if (strlen(fingerprint) != KEYID_LENGTH) { + cons_show_error("Invalid fingerprint length for: %s", fingerprint); + } + cons_show("Requesting Public Key %s for %s", fingerprint, jid); log_info("[OX] Request %s's public key %s.", jid, fingerprint); // iq