Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/xmpp.c @ 2295:eb96666502f5
Carbons: Check barejid in sent messages, too
author | franky |
---|---|
date | Sun, 29 Jan 2017 20:44:11 +0100 |
parents | 2a9569fd7644 |
children | 4f3821bda633 |
comparison
equal
deleted
inserted
replaced
2294:2a9569fd7644 | 2295:eb96666502f5 |
---|---|
1134 gboolean carbons = FALSE; | 1134 gboolean carbons = FALSE; |
1135 if (x && (!g_strcmp0(x->name, "received") || !g_strcmp0(x->name, "sent"))) { | 1135 if (x && (!g_strcmp0(x->name, "received") || !g_strcmp0(x->name, "sent"))) { |
1136 LmMessageNode *xenc; | 1136 LmMessageNode *xenc; |
1137 const char *carbon_name = x->name; | 1137 const char *carbon_name = x->name; |
1138 carbons = TRUE; | 1138 carbons = TRUE; |
1139 | |
1140 // Check envelope JID for carbon messages | |
1141 if (!jid_equal(lm_connection_get_jid(lconnection), bjid)) { | |
1142 scr_LogPrint(LPRINT_LOGNORM, "Received invalid carbon copy from %s.", bjid); | |
1143 goto handle_messages_return; | |
1144 } | |
1145 | |
1139 // Go 1 level deeper to the forwarded message | 1146 // Go 1 level deeper to the forwarded message |
1140 x = lm_message_node_find_xmlns(x, NS_FORWARD); | 1147 x = lm_message_node_find_xmlns(x, NS_FORWARD); |
1141 if (x) | 1148 if (x) |
1142 x = lm_message_node_get_child(x, "message"); | 1149 x = lm_message_node_get_child(x, "message"); |
1143 | 1150 |
1156 else | 1163 else |
1157 skip_process = TRUE; | 1164 skip_process = TRUE; |
1158 | 1165 |
1159 // Parse a message that is send to one of our other resources | 1166 // Parse a message that is send to one of our other resources |
1160 if (!g_strcmp0(carbon_name, "received")) { | 1167 if (!g_strcmp0(carbon_name, "received")) { |
1161 // Check envelope JID for carbon messages | |
1162 gchar *self_bjid = jidtodisp(lm_connection_get_jid(lconnection)); | |
1163 if (g_strcmp0(self_bjid, bjid)) { | |
1164 scr_LogPrint(LPRINT_LOGNORM, "Received invalid carbon copy!"); | |
1165 g_free(self_bjid); | |
1166 goto handle_messages_return; | |
1167 } | |
1168 g_free(self_bjid); | |
1169 | |
1170 from = lm_message_node_get_attribute(x, "from"); | 1168 from = lm_message_node_get_attribute(x, "from"); |
1171 if (!from) { | 1169 if (!from) { |
1172 scr_LogPrint(LPRINT_LOGNORM, "Malformed carbon copy!"); | 1170 scr_LogPrint(LPRINT_LOGNORM, "Malformed carbon copy!"); |
1173 goto handle_messages_return; | 1171 goto handle_messages_return; |
1174 } | 1172 } |