diff options
author | Paul Fariello <paul@fariello.eu> | 2019-03-29 13:54:21 +0100 |
---|---|---|
committer | Paul Fariello <paul@fariello.eu> | 2019-04-10 17:23:45 +0200 |
commit | 0d0e2b246ac3ec7a415f7dd50fca77ab802f885f (patch) | |
tree | f9c9c70f0a6485f6c7577f1d4237a21f4b7bd202 | |
parent | 562302846af07cb7b7bde894741840419a6b42dd (diff) | |
download | profani-tty-0d0e2b246ac3ec7a415f7dd50fca77ab802f885f.tar.gz |
Add support for missing from in bundle iq
-rw-r--r-- | src/xmpp/omemo.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/xmpp/omemo.c b/src/xmpp/omemo.c index 66b0ebcc..c8ac7ed5 100644 --- a/src/xmpp/omemo.c +++ b/src/xmpp/omemo.c @@ -107,9 +107,14 @@ omemo_bundle_request(const char * const jid, uint32_t device_id, ProfIqCallback int omemo_start_device_session_handle_bundle(xmpp_stanza_t *const stanza, void *const userdata) { - const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); - if (!from) { - return 1; + char *from = NULL; + const char *from_attr = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); + if (!from_attr) { + Jid *jid = jid_create(connection_get_fulljid()); + from = strdup(jid->barejid); + jid_destroy(jid); + } else { + from = strdup(from_attr); } if (g_strcmp0(from, userdata) != 0) { @@ -219,6 +224,7 @@ omemo_start_device_session_handle_bundle(xmpp_stanza_t *const stanza, void *cons signed_prekey_raw, signed_prekey_len, signed_prekey_signature_raw, signed_prekey_signature_len, identity_key_raw, identity_key_len); + free(from); g_list_free_full(prekeys_list, (GDestroyNotify)omemo_key_free); g_free(signed_prekey_raw); g_free(identity_key_raw); |