20 type = "valid" |
20 type = "valid" |
21 else |
21 else |
22 type = "invalid" |
22 type = "invalid" |
23 log("warn", "Asked to verify a dialback key that was incorrect. An imposter is claiming to be %s?", attr.to); |
23 log("warn", "Asked to verify a dialback key that was incorrect. An imposter is claiming to be %s?", attr.to); |
24 end |
24 end |
|
25 log("debug", "verifyied dialback key... it is %s", type); |
25 origin.sends2s(format("<db:verify from='%s' to='%s' id='%s' type='%s'>%s</db:verify>", attr.to, attr.from, attr.id, type, stanza[1])); |
26 origin.sends2s(format("<db:verify from='%s' to='%s' id='%s' type='%s'>%s</db:verify>", attr.to, attr.from, attr.id, type, stanza[1])); |
26 end); |
27 end); |
27 |
28 |
28 add_handler("s2sin_unauthed", "result", xmlns_dialback, |
29 add_handler("s2sin_unauthed", "result", xmlns_dialback, |
29 function (origin, stanza) |
30 function (origin, stanza) |
36 origin.dialback_key = stanza[1]; |
37 origin.dialback_key = stanza[1]; |
37 log("debug", "asking %s if key %s belongs to them", origin.from_host, origin.dialback_key); |
38 log("debug", "asking %s if key %s belongs to them", origin.from_host, origin.dialback_key); |
38 send_s2s(origin.to_host, origin.from_host, |
39 send_s2s(origin.to_host, origin.from_host, |
39 format("<db:verify from='%s' to='%s' id='%s'>%s</db:verify>", origin.to_host, origin.from_host, |
40 format("<db:verify from='%s' to='%s' id='%s'>%s</db:verify>", origin.to_host, origin.from_host, |
40 origin.streamid, origin.dialback_key)); |
41 origin.streamid, origin.dialback_key)); |
41 hosts[origin.from_host].dialback_verifying = origin; |
42 hosts[origin.to_host].s2sout[origin.from_host].dialback_verifying = origin; |
42 end); |
43 end); |
43 |
44 |
44 add_handler({ "s2sout_unauthed", "s2sout" }, "verify", xmlns_dialback, |
45 add_handler({ "s2sout_unauthed", "s2sout" }, "verify", xmlns_dialback, |
45 function (origin, stanza) |
46 function (origin, stanza) |
46 if origin.dialback_verifying then |
47 if origin.dialback_verifying then |