From 7fc47fa72f188e7371f16ca5d6d6d6199bc54ef6 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 6 Jan 2018 08:54:15 +0100 Subject: mod_component: Advertise disco#info in fallback handling of disco#info query (fixes #1062) --- plugins/mod_component.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua index 476dff8a..15f405e5 100644 --- a/plugins/mod_component.lua +++ b/plugins/mod_component.lua @@ -120,7 +120,8 @@ function module.add_host(module) local name = module:get_option_string("name"); if name then event.origin.send(st.reply(stanza):tag("query", { xmlns = "http://jabber.org/protocol/disco#info" }) - :tag("identity", { category = "component", type = "generic", name = module:get_option_string("name", "Prosody") })) + :tag("identity", { category = "component", type = "generic", name = module:get_option_string("name", "Prosody") })):up() + :tag("feature", { var = "http://jabber.org/protocol/disco#info" }):up() return true; end end -- cgit v1.2.3 From 9c40b0ab8c644246861a3bcb5dc4fa186802c07f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 4 Feb 2018 01:13:27 +0100 Subject: Backed out changeset 89c42aff8510: The problem in ejabberd has reportedly been resolved and this change causes more problems than it solves (fixes #1006) --- plugins/mod_dialback.lua | 8 ++++++++ plugins/mod_saslauth.lua | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index dcbf9448..cc1615cf 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -189,6 +189,14 @@ module:hook("stanza/jabber:server:dialback:result", function(event) end end); +module:hook_stanza("urn:ietf:params:xml:ns:xmpp-sasl", "failure", function (origin, stanza) + if origin.external_auth == "failed" then + module:log("debug", "SASL EXTERNAL failed, falling back to dialback"); + initiate_dialback(origin); + return true; + end +end, 100); + module:hook_stanza(xmlns_stream, "features", function (origin, stanza) if not origin.external_auth or origin.external_auth == "failed" then module:log("debug", "Initiating dialback..."); diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index b5ec4057..55b93cda 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -110,10 +110,12 @@ module:hook_tag(xmlns_sasl, "failure", function (session, stanza) module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition); session.external_auth = "failed" - session:close(); - return true; end, 500) +module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) + -- TODO: Dialback wasn't loaded. Do something useful. +end, 90) + module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) if session.type ~= "s2sout_unauthed" or not session.secure then return; end -- cgit v1.2.3 From 0e96df74102467122e107756073053abd96b9670 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 4 Feb 2018 00:58:38 +0100 Subject: mod_saslauth: Close connection if no fallback kicks in on SASL EXTERNAL failure --- plugins/mod_saslauth.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index 55b93cda..3ca709e0 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -113,7 +113,9 @@ module:hook_tag(xmlns_sasl, "failure", function (session, stanza) end, 500) module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) - -- TODO: Dialback wasn't loaded. Do something useful. + session.log("debug", "No fallback from SASL EXTERNAL failure, giving up"); + session:close(); + return true; end, 90) module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) -- cgit v1.2.3 From e00503705b568cd532f38373fde34757bc580296 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 4 Feb 2018 01:01:50 +0100 Subject: mod_saslauth: Pass SASL EXTERNAL failure reason on to be used in error bounces --- plugins/mod_saslauth.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index 3ca709e0..3eda2a24 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -110,11 +110,12 @@ module:hook_tag(xmlns_sasl, "failure", function (session, stanza) module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition); session.external_auth = "failed" + session.external_auth_failure_reason = condition; end, 500) module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) session.log("debug", "No fallback from SASL EXTERNAL failure, giving up"); - session:close(); + session:close(nil, session.external_auth_failure_reason); return true; end, 90) -- cgit v1.2.3 From 1d0cbb646de4c3cdb94a018c415eedb8e720d204 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 4 Feb 2018 01:03:44 +0100 Subject: mod_saslauth: Use renamed API for hooking non-stanzas --- plugins/mod_saslauth.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index 3eda2a24..f747ab40 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -113,7 +113,7 @@ module:hook_tag(xmlns_sasl, "failure", function (session, stanza) session.external_auth_failure_reason = condition; end, 500) -module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) +module:hook_tag(xmlns_sasl, "failure", function (session, stanza) session.log("debug", "No fallback from SASL EXTERNAL failure, giving up"); session:close(nil, session.external_auth_failure_reason); return true; -- cgit v1.2.3 From aaa7b42c76f5254c179ff24e536f1114edd6e3dd Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 4 Feb 2018 01:05:06 +0100 Subject: mod_saslauth: Ignore unused argument [luacheck] --- plugins/mod_saslauth.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index f747ab40..fba84ef8 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -113,7 +113,7 @@ module:hook_tag(xmlns_sasl, "failure", function (session, stanza) session.external_auth_failure_reason = condition; end, 500) -module:hook_tag(xmlns_sasl, "failure", function (session, stanza) +module:hook_tag(xmlns_sasl, "failure", function (session, stanza) -- luacheck: ignore 212/stanza session.log("debug", "No fallback from SASL EXTERNAL failure, giving up"); session:close(nil, session.external_auth_failure_reason); return true; -- cgit v1.2.3 From 70ac80470e195367fa79e3ff8630d75ae3d24ee5 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 4 Feb 2018 01:06:40 +0100 Subject: mod_dialback: Use renamed API for hooking non-stanza tags --- plugins/mod_dialback.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index cc1615cf..9afde365 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -189,7 +189,7 @@ module:hook("stanza/jabber:server:dialback:result", function(event) end end); -module:hook_stanza("urn:ietf:params:xml:ns:xmpp-sasl", "failure", function (origin, stanza) +module:hook_tag("urn:ietf:params:xml:ns:xmpp-sasl", "failure", function (origin, stanza) if origin.external_auth == "failed" then module:log("debug", "SASL EXTERNAL failed, falling back to dialback"); initiate_dialback(origin); @@ -197,7 +197,7 @@ module:hook_stanza("urn:ietf:params:xml:ns:xmpp-sasl", "failure", function (orig end end, 100); -module:hook_stanza(xmlns_stream, "features", function (origin, stanza) +module:hook_tag(xmlns_stream, "features", function (origin, stanza) if not origin.external_auth or origin.external_auth == "failed" then module:log("debug", "Initiating dialback..."); initiate_dialback(origin); -- cgit v1.2.3 From 7905d729ef845d0c13297c9d8051ff30bbd71c07 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 4 Feb 2018 01:16:28 +0100 Subject: mod_dialback: Split long line [luacheck] --- plugins/mod_dialback.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index 9afde365..736d0f5d 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -153,7 +153,8 @@ module:hook("stanza/jabber:server:dialback:verify", function(event) valid = "invalid"; end if dialback_verifying.destroyed then - log("warn", "Incoming s2s session %s was closed in the meantime, so we can't notify it of the db result", tostring(dialback_verifying):match("%w+$")); + log("warn", "Incoming s2s session %s was closed in the meantime, so we can't notify it of the db result", + tostring(dialback_verifying):match("%w+$")); else dialback_verifying.sends2s( st.stanza("db:result", { from = attr.to, to = attr.from, id = attr.id, type = valid }) -- cgit v1.2.3 From 7190264e1842aeced4a2bd936c41813a62fff1b8 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 4 Feb 2018 01:16:43 +0100 Subject: mod_dialback: Expand abbrevation --- plugins/mod_dialback.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index 736d0f5d..6a915576 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -153,7 +153,7 @@ module:hook("stanza/jabber:server:dialback:verify", function(event) valid = "invalid"; end if dialback_verifying.destroyed then - log("warn", "Incoming s2s session %s was closed in the meantime, so we can't notify it of the db result", + log("warn", "Incoming s2s session %s was closed in the meantime, so we can't notify it of the dialback result", tostring(dialback_verifying):match("%w+$")); else dialback_verifying.sends2s( -- cgit v1.2.3 From d8d5861feced162f170d17e845f8617031c2097c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 4 Feb 2018 01:17:22 +0100 Subject: mod_dialback: Ignore unused arguments [luacheck] --- plugins/mod_dialback.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index 6a915576..eddc3209 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -190,7 +190,7 @@ module:hook("stanza/jabber:server:dialback:result", function(event) end end); -module:hook_tag("urn:ietf:params:xml:ns:xmpp-sasl", "failure", function (origin, stanza) +module:hook_tag("urn:ietf:params:xml:ns:xmpp-sasl", "failure", function (origin, stanza) -- luacheck: ignore 212/stanza if origin.external_auth == "failed" then module:log("debug", "SASL EXTERNAL failed, falling back to dialback"); initiate_dialback(origin); @@ -198,7 +198,7 @@ module:hook_tag("urn:ietf:params:xml:ns:xmpp-sasl", "failure", function (origin, end end, 100); -module:hook_tag(xmlns_stream, "features", function (origin, stanza) +module:hook_tag(xmlns_stream, "features", function (origin, stanza) -- luacheck: ignore 212/stanza if not origin.external_auth or origin.external_auth == "failed" then module:log("debug", "Initiating dialback..."); initiate_dialback(origin); -- cgit v1.2.3