112 local attr = stanza.attr; |
112 local attr = stanza.attr; |
113 print(tostring(attr.to), tostring(attr.from)) |
113 print(tostring(attr.to), tostring(attr.from)) |
114 print(tostring(origin.to_host), tostring(origin.from_host)) |
114 print(tostring(origin.to_host), tostring(origin.from_host)) |
115 -- FIXME: Grr, ejabberd breaks this one too?? it is black and white in XEP-220 example 34 |
115 -- FIXME: Grr, ejabberd breaks this one too?? it is black and white in XEP-220 example 34 |
116 --if attr.from ~= origin.to_host then error("invalid-from"); end |
116 --if attr.from ~= origin.to_host then error("invalid-from"); end |
117 local type = "invalid"; |
117 local type; |
118 if s2s_verify_dialback(attr.id, attr.from, attr.to, stanza[1]) then |
118 if s2s_verify_dialback(attr.id, attr.from, attr.to, stanza[1]) then |
119 type = "valid" |
119 type = "valid" |
|
120 else |
|
121 type = "invalid" |
|
122 log("warn", "Asked to verify a dialback key that was incorrect. An imposter is claiming to be %s?", attr.to); |
120 end |
123 end |
121 origin.send(format("<db:verify from='%s' to='%s' id='%s' type='%s'>%s</db:verify>", attr.to, attr.from, attr.id, type, stanza[1])); |
124 origin.send(format("<db:verify from='%s' to='%s' id='%s' type='%s'>%s</db:verify>", attr.to, attr.from, attr.id, type, stanza[1])); |
122 elseif stanza.name == "result" and origin.type == "s2sin_unauthed" then |
125 elseif stanza.name == "result" and origin.type == "s2sin_unauthed" then |
123 -- he wants to be identified through dialback |
126 -- he wants to be identified through dialback |
124 -- We need to check the key with the Authoritative server |
127 -- We need to check the key with the Authoritative server |