Software /
code /
prosody
Comparison
plugins/mod_dialback.lua @ 10376:b337df192a10
mod_dialback: Abort early if request is missing addressing attributes
Prevents traceback from passing nil to nameprep()
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 02 Nov 2019 15:27:53 +0100 |
parent | 8518:0de0018bdf91 |
child | 10380:18685a5e362e |
comparison
equal
deleted
inserted
replaced
10375:3d0adbc74c39 | 10376:b337df192a10 |
---|---|
91 | 91 |
92 if origin.type == "s2sin_unauthed" or origin.type == "s2sin" then | 92 if origin.type == "s2sin_unauthed" or origin.type == "s2sin" then |
93 -- he wants to be identified through dialback | 93 -- he wants to be identified through dialback |
94 -- We need to check the key with the Authoritative server | 94 -- We need to check the key with the Authoritative server |
95 local attr = stanza.attr; | 95 local attr = stanza.attr; |
96 if not attr.to or not attr.from then | |
97 origin.log("debug", "Missing Dialback addressing (from=%q, to=%q)", attr.from, attr.to); | |
98 origin:close("improper-addressing"); | |
99 return true; | |
100 end | |
96 local to, from = nameprep(attr.to), nameprep(attr.from); | 101 local to, from = nameprep(attr.to), nameprep(attr.from); |
97 | 102 |
98 if not hosts[to] then | 103 if not hosts[to] then |
99 -- Not a host that we serve | 104 -- Not a host that we serve |
100 origin.log("warn", "%s tried to connect to %s, which we don't serve", from, to); | 105 origin.log("warn", "%s tried to connect to %s, which we don't serve", from, to); |