Comparison

plugins/mod_mam/mod_mam.lua @ 11759:9925be5d3b8b

mod_mam: Only check for locally generated stanza-ids Otherwise a message archived by a remote server would be incorrectly silently discarded. This should be safe from spoofing thanks to strip_stanza_id earlier in the event chain.
author Kim Alvefur <zash@zash.se>
date Tue, 31 Aug 2021 11:26:42 +0200
parent 11758:c35b81575d5d
child 11760:d66738eeb875
comparison
equal deleted inserted replaced
11758:c35b81575d5d 11759:9925be5d3b8b
478 -- have been archived. This would generally only happen if mod_offline is 478 -- have been archived. This would generally only happen if mod_offline is
479 -- disabled. Otherwise the message would generate a delivery failure report, 479 -- disabled. Otherwise the message would generate a delivery failure report,
480 -- which would not be accurate because it has been archived. 480 -- which would not be accurate because it has been archived.
481 module:hook("message/offline/handle", function(event) 481 module:hook("message/offline/handle", function(event)
482 local stanza = event.stanza; 482 local stanza = event.stanza;
483 if stanza:get_child("stanza-id", xmlns_st_id) then 483 local user = event.username .. "@" .. host;
484 return true; 484 for st_id in stanza:childtags("stanza-id", xmlns_st_id) do
485 if st_id.attr.by == user then
486 return true;
487 end
485 end 488 end
486 end, -2); 489 end, -2);
487 490
488 if cleanup_after ~= "never" then 491 if cleanup_after ~= "never" then
489 local cleanup_storage = module:open_store("archive_cleanup"); 492 local cleanup_storage = module:open_store("archive_cleanup");