[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

@ -63,8 +63,26 @@ PresenceStanza(ParseeData *args, XMLElement *stanza)
XMLElement *user_info;
XMLElement *vc = XMLookForTKV(stanza, "x", "xmlns", "vcard-temp:x:update");
XMLElement *status = XMLookForUnique(stanza, "status");
char *oid = HashMapGet(stanza->attrs, "from");
if (ServerHasXEP421(args, oid))
{
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",
oid, occ_id
);
ParseePushOIDTable(oid, occ_id);
}
}
if ((user_info = XMLookForTKV(stanza, "x", "xmlns", MUC_USER_NS)))
{
XMLElement *item = XMLookForUnique(user_info, "item");
@ -259,7 +277,7 @@ PresenceStanza(ParseeData *args, XMLElement *stanza)
{
if (args->verbosity >= PARSEE_VERBOSE_COMICAL)
{
Log(LOG_DEBUG,
Log(LOG_WARNING,
"VCard: %s is already cached for %s", avatar_id, oid
);
}
@ -267,10 +285,6 @@ PresenceStanza(ParseeData *args, XMLElement *stanza)
return;
}
if (args->verbosity >= PARSEE_VERBOSE_COMICAL)
{
Log(LOG_DEBUG, "VCard: %s for %s", p_dat->data, oid);
}
JsonValueFree(JsonSet(
json, JsonValueString(p_dat->data),
1, oid)
@ -279,6 +293,9 @@ PresenceStanza(ParseeData *args, XMLElement *stanza)
from = ParseeJID(args);
Log(LOG_DEBUG,
"Sending a vCard avatar request for %s(=%s)", oid, p_dat->data
);
vcard_request = CreateVCardRequest(
from, HashMapGet(stanza->attrs, "from")
);