diff options
author | Waqas Hussain <waqas20@gmail.com> | 2008-11-06 16:57:10 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2008-11-06 16:57:10 +0500 |
commit | a88ddeb67d6d8a31da4ac79d1c2d1a1d776c2c7c (patch) | |
tree | 87f6bec4cca50a58699b7f028c14482f72100792 | |
parent | 0ff2eacdaff1bd87affc600c35d005a34eda9e04 (diff) | |
download | prosody-a88ddeb67d6d8a31da4ac79d1c2d1a1d776c2c7c.tar.gz prosody-a88ddeb67d6d8a31da4ac79d1c2d1a1d776c2c7c.zip |
Fixed some whitespace.
-rw-r--r-- | plugins/mod_dialback.lua | 101 | ||||
-rw-r--r-- | plugins/mod_version.lua | 13 |
2 files changed, 58 insertions, 56 deletions
diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index 9ff181b7..dd9704f2 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -9,59 +9,62 @@ local log = require "util.logger".init("mod_dialback"); local xmlns_dialback = "jabber:server:dialback"; add_handler({"s2sin_unauthed", "s2sin"}, "verify", xmlns_dialback, - function (origin, stanza) - -- We are being asked to verify the key, to ensure it was generated by us - log("debug", "verifying dialback key..."); - local attr = stanza.attr; - -- FIXME: Grr, ejabberd breaks this one too?? it is black and white in XEP-220 example 34 - --if attr.from ~= origin.to_host then error("invalid-from"); end - local type; - if s2s_verify_dialback(attr.id, attr.from, attr.to, stanza[1]) then - type = "valid" - else - type = "invalid" - log("warn", "Asked to verify a dialback key that was incorrect. An imposter is claiming to be %s?", attr.to); - end - 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])); - end); + function (origin, stanza) + -- We are being asked to verify the key, to ensure it was generated by us + log("debug", "verifying dialback key..."); + local attr = stanza.attr; + -- FIXME: Grr, ejabberd breaks this one too?? it is black and white in XEP-220 example 34 + --if attr.from ~= origin.to_host then error("invalid-from"); end + local type; + if s2s_verify_dialback(attr.id, attr.from, attr.to, stanza[1]) then + type = "valid" + else + type = "invalid" + log("warn", "Asked to verify a dialback key that was incorrect. An imposter is claiming to be %s?", attr.to); + end + 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])); + end); add_handler("s2sin_unauthed", "result", xmlns_dialback, - function (origin, stanza) - -- he wants to be identified through dialback - -- We need to check the key with the Authoritative server - local attr = stanza.attr; - 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, format("<db:verify from='%s' to='%s' id='%s'>%s</db:verify>", origin.to_host, origin.from_host, origin.streamid, origin.dialback_key)); - hosts[origin.from_host].dialback_verifying = origin; - end); + function (origin, stanza) + -- he wants to be identified through dialback + -- We need to check the key with the Authoritative server + local attr = stanza.attr; + 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, + format("<db:verify from='%s' to='%s' id='%s'>%s</db:verify>", origin.to_host, origin.from_host, + origin.streamid, origin.dialback_key)); + hosts[origin.from_host].dialback_verifying = origin; + end); add_handler({ "s2sout_unauthed", "s2sout" }, "verify", xmlns_dialback, - function (origin, stanza) - if origin.dialback_verifying then - local valid; - local attr = stanza.attr; - if attr.type == "valid" then - s2s_make_authenticated(origin.dialback_verifying); - valid = "valid"; - else - -- Warn the original connection that is was not verified successfully - log("warn", "dialback for "..(origin.dialback_verifying.from_host or "(unknown)").." failed"); - valid = "invalid"; - end - origin.dialback_verifying.sends2s(format("<db:result from='%s' to='%s' id='%s' type='%s'>%s</db:result>", attr.from, attr.to, attr.id, valid, origin.dialback_verifying.dialback_key)); + function (origin, stanza) + if origin.dialback_verifying then + local valid; + local attr = stanza.attr; + if attr.type == "valid" then + s2s_make_authenticated(origin.dialback_verifying); + valid = "valid"; + else + -- Warn the original connection that is was not verified successfully + log("warn", "dialback for "..(origin.dialback_verifying.from_host or "(unknown)").." failed"); + valid = "invalid"; end - end); + origin.dialback_verifying.sends2s(format("<db:result from='%s' to='%s' id='%s' type='%s'>%s</db:result>", + attr.from, attr.to, attr.id, valid, origin.dialback_verifying.dialback_key)); + end + end); add_handler({ "s2sout_unauthed", "s2sout" }, "result", xmlns_dialback, - function (origin, stanza) - if stanza.attr.type == "valid" then - s2s_make_authenticated(origin); - else - -- FIXME - error("dialback failed!"); - end - end);
\ No newline at end of file + function (origin, stanza) + if stanza.attr.type == "valid" then + s2s_make_authenticated(origin); + else + -- FIXME + error("dialback failed!"); + end + end); diff --git a/plugins/mod_version.lua b/plugins/mod_version.lua index d351d75b..552480e0 100644 --- a/plugins/mod_version.lua +++ b/plugins/mod_version.lua @@ -7,13 +7,12 @@ local log = require "util.logger".init("mod_version"); local xmlns_version = "jabber:iq:version" local function handle_version_request(session, stanza) - if stanza.attr.type == "get" then - session.send(st.reply(stanza) - :query(xmlns_version) - :tag("name"):text("lxmppd"):up() - :tag("version"):text("pre-alpha"):up() - :tag("os"):text("The best one")); - end + if stanza.attr.type == "get" then + session.send(st.reply(stanza):query(xmlns_version) + :tag("name"):text("lxmppd"):up() + :tag("version"):text("pre-alpha"):up() + :tag("os"):text("The best one")); + end end add_iq_handler("c2s", xmlns_version, handle_version_request); |