mod_dialback: Abort early if request is missing addressing attributes
authorKim Alvefur <zash@zash.se>
Sat, 02 Nov 2019 15:27:53 +0100
changeset 10380 b337df192a10
parent 10379 3d0adbc74c39
child 10381 4c36bc28b99e
mod_dialback: Abort early if request is missing addressing attributes Prevents traceback from passing nil to nameprep()
plugins/mod_dialback.lua
--- a/plugins/mod_dialback.lua	Sat Nov 02 13:56:13 2019 +0100
+++ b/plugins/mod_dialback.lua	Sat Nov 02 15:27:53 2019 +0100
@@ -93,6 +93,11 @@
 		-- he wants to be identified through dialback
 		-- We need to check the key with the Authoritative server
 		local attr = stanza.attr;
+		if not attr.to or not attr.from then
+			origin.log("debug", "Missing Dialback addressing (from=%q, to=%q)", attr.from, attr.to);
+			origin:close("improper-addressing");
+			return true;
+		end
 		local to, from = nameprep(attr.to), nameprep(attr.from);
 
 		if not hosts[to] then