From 38060a5ccf530be01713f5055377ff840dd77145 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(-) (limited to 'plugins') 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 5a07b39c7fb46f93b4af1288d8c4dfaba9cedbb3 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(-) (limited to 'plugins') 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 477f77e250da47f9160c524101ab3e1efcae9dc8 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(-) (limited to 'plugins') 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 e925f5a34a7b77f0da480c46f2c81204626126c0 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(-) (limited to 'plugins') 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 e1542aa2eeea55a335923c9006deaeeacbec7d73 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(-) (limited to 'plugins') 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 c1157eb0aeaa1493d3e8bc53871943f41833bb53 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(-) (limited to 'plugins') 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 c1362a6093aaab90d4e0de43ca58c95e6f40fa79 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(-) (limited to 'plugins') 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 a15eb17b9cf66050e263b607b1a5bb3946ba6734 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(-) (limited to 'plugins') 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 e8ff8bf60614fc6b058518242599052c4411126f 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(-) (limited to 'plugins') 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 cf7486984a083cbe6653063814aa893dcae20054 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(-) (limited to 'plugins') 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