From b1b108de84bd474d97bbc9931e071969fbd65d17 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 6 Mar 2017 15:55:37 +0100 Subject: mod_tls: Switch to hook_tag from hook_stanza which was renamed in 2087d42f1e77 --- plugins/mod_tls.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua index fbeb344b..48613b9a 100644 --- a/plugins/mod_tls.lua +++ b/plugins/mod_tls.lua @@ -122,7 +122,7 @@ module:hook("s2s-stream-features", function(event) end); -- For s2sout connections, start TLS if we can -module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) +module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) module:log("debug", "Received features element"); if can_do_tls(session) and stanza:get_child("starttls", xmlns_starttls) then module:log("debug", "%s is offering TLS, taking up the offer...", session.to_host); @@ -131,7 +131,7 @@ module:hook_stanza("http://etherx.jabber.org/streams", "features", function (ses end end, 500); -module:hook_stanza(xmlns_starttls, "proceed", function (session, stanza) -- luacheck: ignore 212/stanza +module:hook_tag(xmlns_starttls, "proceed", function (session, stanza) -- luacheck: ignore 212/stanza if session.type == "s2sout_unauthed" and can_do_tls(session) then module:log("debug", "Proceeding with TLS on s2sout..."); session:reset_stream(); -- cgit v1.2.3 From 7e3a83a35b66db9a88dac62079b71331630cefa9 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 6 Mar 2017 15:56:12 +0100 Subject: mod_saslauth: Switch to hook_tag from hook_stanza which was renamed in 2087d42f1e77 --- plugins/mod_saslauth.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index ee468c17..b3a3aaa9 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -82,7 +82,7 @@ local function sasl_process_cdata(session, stanza) return true; end -module:hook_stanza(xmlns_sasl, "success", function (session, stanza) +module:hook_tag(xmlns_sasl, "success", function (session, stanza) if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end module:log("debug", "SASL EXTERNAL with %s succeeded", session.to_host); session.external_auth = "succeeded" @@ -93,7 +93,7 @@ module:hook_stanza(xmlns_sasl, "success", function (session, stanza) return true; end) -module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) +module:hook_tag(xmlns_sasl, "failure", function (session, stanza) if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end local text = stanza:get_child_text("text"); @@ -114,7 +114,7 @@ module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) return true; end, 500) -module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) +module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) if session.type ~= "s2sout_unauthed" or not session.secure then return; end local mechanisms = stanza:get_child("mechanisms", xmlns_sasl) -- cgit v1.2.3 From 9a5dda17fd9f7d0b9f246ddd17f1623ee338236b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 6 Mar 2017 16:01:27 +0100 Subject: tests: Trim trailing whitespace --- tests/test_utf8.lua | 2 +- tests/test_util_cache.lua | 34 +++++++++++++++++----------------- tests/test_util_stanza.lua | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/test_utf8.lua b/tests/test_utf8.lua index db59a70f..48859960 100644 --- a/tests/test_utf8.lua +++ b/tests/test_utf8.lua @@ -4,7 +4,7 @@ package.path = "../?.lua"; function valid() local encodings = require "util.encodings"; local utf8 = assert(encodings.utf8, "no encodings.utf8 module"); - + for line in io.lines("utf8_sequences.txt") do local data = line:match(":%s*([^#]+)"):gsub("%s+", ""):gsub("..", function (c) return string.char(tonumber(c, 16)); end) local expect = line:match("(%S+):"); diff --git a/tests/test_util_cache.lua b/tests/test_util_cache.lua index a5e25e75..4240c433 100644 --- a/tests/test_util_cache.lua +++ b/tests/test_util_cache.lua @@ -10,7 +10,7 @@ function new(new) expect_kv(nil, nil, c:tail()); assert_equal(c:count(), 0); - + c:set("one", 1) assert_equal(c:count(), 1); expect_kv("one", 1, c:head()); @@ -29,12 +29,12 @@ function new(new) assert_equal(c:count(), 5); expect_kv("five", 5, c:head()); expect_kv("one", 1, c:tail()); - + c:set("foo", nil); assert_equal(c:count(), 5); expect_kv("five", 5, c:head()); expect_kv("one", 1, c:tail()); - + assert_equal(c:get("one"), 1); expect_kv("five", 5, c:head()); expect_kv("one", 1, c:tail()); @@ -46,32 +46,32 @@ function new(new) assert_equal(c:get("foo"), nil); assert_equal(c:get("bar"), nil); - + c:set("six", 6); assert_equal(c:count(), 5); expect_kv("six", 6, c:head()); expect_kv("two", 2, c:tail()); - + assert_equal(c:get("one"), nil); assert_equal(c:get("two"), 2); assert_equal(c:get("three"), 3); assert_equal(c:get("four"), 4); assert_equal(c:get("five"), 5); assert_equal(c:get("six"), 6); - + c:set("three", nil); assert_equal(c:count(), 4); - + assert_equal(c:get("one"), nil); assert_equal(c:get("two"), 2); assert_equal(c:get("three"), nil); assert_equal(c:get("four"), 4); assert_equal(c:get("five"), 5); assert_equal(c:get("six"), 6); - + c:set("seven", 7); assert_equal(c:count(), 5); - + assert_equal(c:get("one"), nil); assert_equal(c:get("two"), 2); assert_equal(c:get("three"), nil); @@ -79,10 +79,10 @@ function new(new) assert_equal(c:get("five"), 5); assert_equal(c:get("six"), 6); assert_equal(c:get("seven"), 7); - + c:set("eight", 8); assert_equal(c:count(), 5); - + assert_equal(c:get("one"), nil); assert_equal(c:get("two"), nil); assert_equal(c:get("three"), nil); @@ -91,10 +91,10 @@ function new(new) assert_equal(c:get("six"), 6); assert_equal(c:get("seven"), 7); assert_equal(c:get("eight"), 8); - + c:set("four", 4); assert_equal(c:count(), 5); - + assert_equal(c:get("one"), nil); assert_equal(c:get("two"), nil); assert_equal(c:get("three"), nil); @@ -103,10 +103,10 @@ function new(new) assert_equal(c:get("six"), 6); assert_equal(c:get("seven"), 7); assert_equal(c:get("eight"), 8); - + c:set("nine", 9); assert_equal(c:count(), 5); - + assert_equal(c:get("one"), nil); assert_equal(c:get("two"), nil); assert_equal(c:get("three"), nil); @@ -268,7 +268,7 @@ function new(new) local c4 = new(3, false); - + assert_equal(c4:set("a", 1), true); assert_equal(c4:set("a", 1), true); assert_equal(c4:set("a", 1), true); @@ -290,7 +290,7 @@ function new(new) end return false; end); - + assert_equal(c5:set("a", 1), true); assert_equal(c5:set("a", 1), true); assert_equal(c5:set("a", 1), true); diff --git a/tests/test_util_stanza.lua b/tests/test_util_stanza.lua index bc0ac64a..4be07a4b 100644 --- a/tests/test_util_stanza.lua +++ b/tests/test_util_stanza.lua @@ -37,7 +37,7 @@ function stanza(stanza) assert_equal(s1.attr.xmlns, nil); assert_equal(#s1, 0); assert_equal(#s1.tags, 0); - + s1:tag("child1"); assert_equal(#s1.tags, 1); assert_equal(s1.tags[1].name, "child1"); @@ -47,7 +47,7 @@ function stanza(stanza) assert_equal(s1.tags[1].name, "child1"); assert_equal(#s1.tags[1], 1); assert_equal(s1.tags[1][1].name, "grandchild1"); - + s1:up():tag("child2"); assert_equal(#s1.tags, 2, tostring(s1)); assert_equal(s1.tags[1].name, "child1"); -- cgit v1.2.3 From 66618bf09cc664d9375bf41174297714782b4346 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 6 Mar 2017 16:05:24 +0100 Subject: mod_saslauth: Fix typoed variable name [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 b3a3aaa9..8bbf6349 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -105,7 +105,7 @@ module:hook_tag(xmlns_sasl, "failure", function (session, stanza) end end if text and condition then - condition = connection .. ": " .. text; + condition = condition .. ": " .. text; end module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition); -- cgit v1.2.3