From f6e6bc0bd98cd80284856cca780442361c6f1f88 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 2 Mar 2017 03:03:04 +0100 Subject: mod_websocket: Include xml:lang attribute on stream (fixes #840) --- plugins/mod_websocket.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins') diff --git a/plugins/mod_websocket.lua b/plugins/mod_websocket.lua index 47d170a1..01f2fa5b 100644 --- a/plugins/mod_websocket.lua +++ b/plugins/mod_websocket.lua @@ -54,6 +54,7 @@ local c2s_listener = portmanager.get_service("c2s").listener; local function session_open_stream(session) local attr = { xmlns = xmlns_framing, + ["xml:lang"] = "en", version = "1.0", id = session.streamid or "", from = session.host -- cgit v1.2.3 From fd19cd42b0d97ead99d7af196d98d2ffdd51dcec Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 2 Mar 2017 03:03:25 +0100 Subject: mod_websocket: Make open_stream method behave like the one from util.xmppstream --- plugins/mod_websocket.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_websocket.lua b/plugins/mod_websocket.lua index 01f2fa5b..3c96f780 100644 --- a/plugins/mod_websocket.lua +++ b/plugins/mod_websocket.lua @@ -51,14 +51,17 @@ local sessions = module:shared("c2s/sessions"); local c2s_listener = portmanager.get_service("c2s").listener; --- Session methods -local function session_open_stream(session) +local function session_open_stream(session, from, to) local attr = { xmlns = xmlns_framing, ["xml:lang"] = "en", version = "1.0", id = session.streamid or "", - from = session.host + from = from or session.host, to = to, }; + if session.stream_attrs then + session:stream_attrs(from, to, attr) + end session.send(st.stanza("open", attr)); end -- cgit v1.2.3 From d471c7b124575cb2657c0e80711e8803f797b25f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 2 Mar 2017 15:17:32 +0100 Subject: mod_saslauth: Log SASL failure reason --- plugins/mod_saslauth.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index c5d3dc91..d374633e 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -96,8 +96,19 @@ end) module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end - module:log("info", "SASL EXTERNAL with %s failed", session.to_host) - -- TODO: Log the failure reason + local text = stanza:get_child_text("text"); + local condition = "unknown-condition"; + for child in stanza:childtags() do + if child.name ~= "text" then + condition = child.name; + break; + end + end + if text and condition then + condition = connection .. ": " .. text; + end + module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition); + session.external_auth = "failed" end, 500) -- cgit v1.2.3