1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Add carbons from barejid check

This commit is contained in:
James Booth 2017-02-01 23:17:15 +00:00
parent 60acf6f05b
commit 4c049fb347
2 changed files with 8 additions and 1 deletions

View File

@ -687,6 +687,13 @@ _handle_carbons(xmpp_stanza_t * const stanza)
return FALSE;
}
Jid *my_jid = jid_create(jabber_get_fulljid());
const char *const stanza_from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
if (g_strcmp0(my_jid->barejid, stanza_from) != 0) {
log_warning("Invalid carbon received, from: %s", stanza_from);
return TRUE;
}
char *name = xmpp_stanza_get_name(carbons);
if ((g_strcmp0(name, "received") == 0) || (g_strcmp0(name, "sent")) == 0) {
xmpp_stanza_t *forwarded = xmpp_stanza_get_child_by_ns(carbons, STANZA_NS_FORWARD);

View File

@ -70,7 +70,7 @@ receive_carbon(void **state)
prof_output_exact("unencrypted");
stbbr_send(
"<message type=\"chat\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost\">"
"<message type=\"chat\" to=\"stabber@localhost/profanity\" from=\"stabber@localhost\">"
"<received xmlns=\"urn:xmpp:carbons:2\">"
"<forwarded xmlns=\"urn:xmpp:forward:0\">"
"<message id=\"prof_msg_7\" xmlns=\"jabber:client\" type=\"chat\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/mobile\">"