[MOD] Be stringent about OIDs, use fmemopen

This commit is contained in:
LDA 2024-08-29 15:31:11 +02:00
commit 3366fcb759
8 changed files with 76 additions and 122 deletions

View file

@ -88,14 +88,33 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
from = NULL;
decode_from = NULL;
from_matrix = NULL;
Log(LOG_DEBUG, "<message> usage=%d", MemoryAllocated());
from = HashMapGet(stanza->attrs, "from");
if (ParseeManageBan(args, from, NULL))
{
XMLFreeElement(stanza);
Log(LOG_DEBUG, "<message/> usage=%d (%s:%d)", MemoryAllocated(), __FILE__, __LINE__);
return false;
}
if (ServerHasXEP421(args, from))
{
XMLElement *occupant = XMLookForTKV(
stanza, "occupant-id",
"xmlns", "urn:xmpp:occupant-id:0"
);
char *occ_id = occupant ? HashMapGet(occupant->attrs, "id") : NULL;
if (occ_id)
{
Log(LOG_DEBUG,
"'%s' has support for XEP-421, fetching OID=%s",
from, occ_id
);
ParseePushOIDTable(from, occ_id);
}
}
if (StrEquals(type, "error"))
{
char *type, *text, *user, *parsee;
@ -132,6 +151,7 @@ end_error:
Free(parsee);
Free(room);
Free(user);
Log(LOG_DEBUG, "<message/> usage=%d (%s:%d)", MemoryAllocated(), __FILE__, __LINE__);
return false;
}
@ -402,6 +422,7 @@ end:
Free(decode_from);
Free(room);
Free(to);
Log(LOG_DEBUG, "<message/> usage=%d (%s:%d)", MemoryAllocated(), __FILE__, __LINE__);
return true;
}