mod_firewall: Fix TO/FROM ROLE
authorMatthew Wild <mwild1@gmail.com>
Mon, 11 Dec 2023 19:09:25 +0000
changeset 5796 14e17927c0ec
parent 5795 9d3d719db285
child 5797 e304e19536f2
mod_firewall: Fix TO/FROM ROLE These conditions did not match because get_jid_role() returns a role object. We want to compare based on the name.
mod_firewall/conditions.lib.lua
--- a/mod_firewall/conditions.lib.lua	Mon Dec 11 12:10:43 2023 +0000
+++ b/mod_firewall/conditions.lib.lua	Mon Dec 11 19:09:25 2023 +0000
@@ -205,11 +205,11 @@
 end
 
 function condition_handlers.TO_ROLE(role_name)
-	return ("get_jid_role(bare_to, current_host) == %q"):format(role_name), { "get_jid_role", "current_host", "bare_to" };
+	return ("get_jid_role(bare_to, current_host).name == %q"):format(role_name), { "get_jid_role", "current_host", "bare_to" };
 end
 
 function condition_handlers.FROM_ROLE(role_name)
-	return ("get_jid_role(bare_from, current_host) == %q"):format(role_name), { "get_jid_role", "current_host", "bare_from" };
+	return ("get_jid_role(bare_from, current_host).name == %q"):format(role_name), { "get_jid_role", "current_host", "bare_from" };
 end
 
 local day_numbers = { sun = 0, mon = 2, tue = 3, wed = 4, thu = 5, fri = 6, sat = 7 };