aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-11-15 22:29:24 +0000
committerMatthew Wild <mwild1@gmail.com>2008-11-15 22:29:24 +0000
commit60292ade15292d2398d91a1af6a578d6a20c9f34 (patch)
tree73a5d330473223ad3e0bfb100a2271afacee4855 /plugins
parent7fb57614491db05660e8952634aeac67d4ff22f5 (diff)
parent49ab3af4421a0410a723fa8dc7286d4adf736fc9 (diff)
downloadprosody-60292ade15292d2398d91a1af6a578d6a20c9f34.tar.gz
prosody-60292ade15292d2398d91a1af6a578d6a20c9f34.zip
Merge from waqas
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_legacyauth.lua18
-rw-r--r--plugins/mod_saslauth.lua24
-rw-r--r--plugins/mod_tls.lua7
3 files changed, 10 insertions, 39 deletions
diff --git a/plugins/mod_legacyauth.lua b/plugins/mod_legacyauth.lua
index ed698bf2..07e82549 100644
--- a/plugins/mod_legacyauth.lua
+++ b/plugins/mod_legacyauth.lua
@@ -23,22 +23,10 @@ add_iq_handler("c2s_unauthed", "jabber:iq:auth",
-- Authentication successful!
local success, err = sessionmanager.make_authenticated(session, username);
if success then
- success, err = sessionmanager.bind_resource(session, resource);
- --FIXME: Reply with error
+ local err_type, err_msg;
+ success, err_type, err, err_msg = sessionmanager.bind_resource(session, resource);
if not success then
- local reply = st.reply(stanza);
- reply.attr.type = "error";
- if err == "conflict" then
- reply:tag("error", { code = "409", type = "cancel" })
- :tag("conflict", { xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas" });
- elseif err == "constraint" then
- reply:tag("error", { code = "409", type = "cancel" })
- :tag("already-bound", { xmlns = "x-lxmppd:extensions:legacyauth" });
- elseif err == "auth" then
- reply:tag("error", { code = "401", type = "auth" })
- :tag("not-authorized", { xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas" });
- end
- send(session, reply);
+ session.send(st.error_reply(stanza, err_type, err, err_msg));
return true;
end
end
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 2094867f..7fe84304 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -105,7 +105,6 @@ add_iq_handler("c2s", "urn:ietf:params:xml:ns:xmpp-bind",
local resource;
if stanza.attr.type == "set" then
local bind = stanza.tags[1];
-
if bind and bind.attr.xmlns == xmlns_bind then
resource = bind:child_with_name("resource");
if resource then
@@ -113,26 +112,13 @@ add_iq_handler("c2s", "urn:ietf:params:xml:ns:xmpp-bind",
end
end
end
- local success, err = sm_bind_resource(session, resource);
+ local success, err_type, err, err_msg = sm_bind_resource(session, resource);
if not success then
- local reply = st.reply(stanza);
- reply.attr.type = "error";
- if err == "conflict" then
- reply:tag("error", { type = "modify" })
- :tag("conflict", { xmlns = xmlns_stanzas });
- elseif err == "constraint" then
- reply:tag("error", { type = "cancel" })
- :tag("resource-constraint", { xmlns = xmlns_stanzas });
- elseif err == "auth" then
- reply:tag("error", { type = "cancel" })
- :tag("not-allowed", { xmlns = xmlns_stanzas });
- end
- send(session, reply);
+ session.send(st.error_reply(stanza, err_type, err, err_msg));
else
- local reply = st.reply(stanza);
- reply:tag("bind", { xmlns = xmlns_bind})
- :tag("jid"):text(session.full_jid);
- send(session, reply);
+ session.send(st.reply(stanza)
+ :tag("bind", { xmlns = xmlns_bind})
+ :tag("jid"):text(session.full_jid));
end
end);
diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua
index fe787942..21a35312 100644
--- a/plugins/mod_tls.lua
+++ b/plugins/mod_tls.lua
@@ -1,13 +1,10 @@
local st = require "util.stanza";
local send = require "core.sessionmanager".send_to_session;
-local sm_bind_resource = require "core.sessionmanager".bind_resource;
-local sessions = sessions;
+--local sessions = sessions;
-local usermanager_validate_credentials = require "core.usermanager".validate_credentials;
-local t_concat, t_insert = table.concat, table.insert;
-local tostring = tostring;
+local t_insert = table.insert;
local log = require "util.logger".init("mod_starttls");