mod_smacks: Remove redundant fields
authorKim Alvefur <zash@zash.se>
Wed, 01 Dec 2021 16:26:53 +0100
changeset 11982 628374809421
parent 11981 9f7a6f7d13de
child 11983 705c4c07a860
mod_smacks: Remove redundant fields Given that the registry is scoped per user and the module is scoped per host, there seems no point to checking or storing both username and host here.
plugins/mod_smacks.lua
--- a/plugins/mod_smacks.lua	Wed Dec 01 16:20:40 2021 +0100
+++ b/plugins/mod_smacks.lua	Wed Dec 01 16:26:53 2021 +0100
@@ -82,8 +82,6 @@
 	-- save only actual h value and username/host (for security)
 	old_session_registry.set(session.username, resumption_token, {
 		h = session.handled_stanza_count,
-		username = session.username,
-		host = session.host
 	});
 	return true; -- allow session to be removed from full cache to make room for new one
 end);
@@ -507,8 +505,6 @@
 					-- save only actual h value and username/host (for security)
 					old_session_registry.set(session.username, session.resumption_token, {
 						h = session.handled_stanza_count,
-						username = session.username,
-						host = session.host
 					});
 					session.resumption_token = nil;
 					sessionmanager.destroy_session(session);
@@ -558,9 +554,7 @@
 	if not original_session then
 		session.log("debug", "Tried to resume non-existent session with id %s", id);
 		local old_session = old_session_registry.get(session.username, id);
-		if old_session and session.username == old_session.username
-		and session.host == old_session.host
-		and old_session.h then
+		if old_session then
 			session.send(st.stanza("failed", { xmlns = xmlns_sm, h = format_h(old_session.h) })
 				:tag("item-not-found", { xmlns = xmlns_errors })
 			);