fix: Incorrect omemo decryption error for Key Transport Messages

Correctly handle OMEMO stanzas that contain a <header> but no <payload>.
These "Key Transport Messages" (heartbeats) are used by some clients
for session maintenance and establishing trust.

Ref: a2726b6a7 made the <payload> element mandatory in the parser.
Ref: 4d49c2b74 the bug became user-visible.

Fixes: https://github.com/profanity-im/profanity/issues/2129
Signed-off-by: Michael Vetter <jubalh@iodoru.org>
This commit is contained in:
Michael Vetter
2026-03-22 17:14:24 +01:00
parent a85a33e397
commit e4bfda2f8a
4 changed files with 26 additions and 14 deletions

View File

@@ -1102,6 +1102,8 @@ _handle_groupchat(xmpp_stanza_t* const stanza)
case OMEMO_ERR_DECRYPT_FAILED:
message->plain = g_strdup("OMEMO message received but decryption failed.");
break;
case OMEMO_ERR_KEY_TRANSPORT:
break;
default:
message->plain = g_strdup("OMEMO message received but could not be decrypted.");
break;
@@ -1283,6 +1285,8 @@ _handle_muc_private_message(xmpp_stanza_t* const stanza)
case OMEMO_ERR_DECRYPT_FAILED:
message->plain = g_strdup("OMEMO message received but decryption failed.");
break;
case OMEMO_ERR_KEY_TRANSPORT:
break;
default:
message->plain = g_strdup("OMEMO message received but could not be decrypted.");
break;
@@ -1471,6 +1475,8 @@ _handle_chat(xmpp_stanza_t* const stanza, gboolean is_mam, gboolean is_carbon, c
case OMEMO_ERR_DECRYPT_FAILED:
message->plain = g_strdup("OMEMO message received but decryption failed.");
break;
case OMEMO_ERR_KEY_TRANSPORT:
break;
default:
message->plain = g_strdup("OMEMO message received but could not be decrypted.");
break;