- local attr = stanza.attr;
- origin.from_host = attr.from;
- origin.to_host = attr.to;
- origin.dialback_key = stanza[1];
- log("debug", "asking %s if key %s belongs to them", origin.from_host, origin.dialback_key);
- send_s2s(origin.to_host, origin.from_host,
- st.stanza("db:verify", { from = origin.to_host, to = origin.from_host, id = origin.streamid }):text(origin.dialback_key));
- hosts[origin.to_host].s2sout[origin.from_host].dialback_verifying = origin;
+ origin.hosts[attr.from] = { dialback_key = stanza[1] };
+
+ if not hosts[attr.to] then
+ -- Not a host that we serve
+ origin.log("info", "%s tried to connect to %s, which we don't serve", attr.from, attr.to);
+ origin:close("host-unknown");
+ return;
+ end
+
+ dialback_requests[attr.from] = origin;
+
+ if not origin.from_host then
+ -- Just used for friendlier logging
+ origin.from_host = attr.from;
+ end
+ if not origin.to_host then
+ -- Just used for friendlier logging
+ origin.to_host = attr.to;
+ end
+
+ origin.log("debug", "asking %s if key %s belongs to them", attr.from, stanza[1]);
+ send_s2s(attr.to, attr.from,
+ st.stanza("db:verify", { from = attr.to, to = attr.from, id = origin.streamid }):text(stanza[1]));