From 25bb94216d34a30f9e5c66d2ac9a9c1147bcd247 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 1 Apr 2013 14:45:59 +0100 Subject: mod_s2s: Close incoming s2s with stream error when secure and we don't trust their certificate --- plugins/mod_s2s/mod_s2s.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua index 6893d184..639f464b 100644 --- a/plugins/mod_s2s/mod_s2s.lua +++ b/plugins/mod_s2s/mod_s2s.lua @@ -632,7 +632,11 @@ function check_auth_policy(event) if must_secure and not session.cert_identity_status then module:log("warn", "Forbidding insecure connection to/from %s", host); - session:close(false); + if session.direction == "incoming" then + session:close({ condition = "not-authorized", text = "Your server's certificate is invalid, expired, or not trusted by"..session.to_host }); + else -- Close outgoing connections without warning + session:close(false); + end return false; end end -- cgit v1.2.3 From 37735f0c3e2bdb528847500ea8bb92aca2628ace Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 3 Apr 2013 13:39:41 +0100 Subject: mod_presence: Remove some unused variables --- plugins/mod_presence.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index b6e3fc18..8dac2d35 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -9,7 +9,7 @@ local log = module._log; local require = require; -local pairs, ipairs = pairs, ipairs; +local pairs = pairs; local t_concat, t_insert = table.concat, table.insert; local s_find = string.find; local tonumber = tonumber; @@ -346,7 +346,7 @@ module:hook("presence/full", function(data) end); module:hook("presence/host", function(data) -- inbound presence to the host - local origin, stanza = data.origin, data.stanza; + local stanza = data.stanza; local from_bare = jid_bare(stanza.attr.from); local t = stanza.attr.type; -- cgit v1.2.3 From f118f461393947bf6789493a3592b22f71e0c232 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 3 Apr 2013 13:40:29 +0100 Subject: mod_groups: Add a public function other modules can use to determine if a JID belongs to a given group --- plugins/mod_groups.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugins') diff --git a/plugins/mod_groups.lua b/plugins/mod_groups.lua index 199925f9..9b39b16b 100644 --- a/plugins/mod_groups.lua +++ b/plugins/mod_groups.lua @@ -121,3 +121,8 @@ end function module.unload() datamanager.remove_callback(remove_virtual_contacts); end + +-- Public for other modules to access +function group_contains(group_name, jid) + return groups[group_name][jid]; +end -- cgit v1.2.3 From d82a36ae8087e97e4a196e2386601790e54af4bb Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 3 Apr 2013 13:40:40 +0100 Subject: mod_groups: Remove unused import --- plugins/mod_groups.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_groups.lua b/plugins/mod_groups.lua index 9b39b16b..f7f632c2 100644 --- a/plugins/mod_groups.lua +++ b/plugins/mod_groups.lua @@ -13,7 +13,7 @@ local members; local groups_file; local jid, datamanager = require "util.jid", require "util.datamanager"; -local jid_bare, jid_prep = jid.bare, jid.prep; +local jid_prep = jid.prep; local module_host = module:get_host(); -- cgit v1.2.3 From 64579702abbbb36676a94a86d88cc54c119f4433 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 3 Apr 2013 13:51:59 +0100 Subject: mod_pubsub: Don't send current items to new subscribers (I don't know why we did) --- plugins/mod_pubsub.lua | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_pubsub.lua b/plugins/mod_pubsub.lua index fe6c0b0a..5ff3a029 100644 --- a/plugins/mod_pubsub.lua +++ b/plugins/mod_pubsub.lua @@ -164,16 +164,6 @@ function handlers.set_subscribe(origin, stanza, subscribe) reply = pubsub_error_reply(stanza, ret); end origin.send(reply); - if ok then - -- Send all current items - local ok, items = service:get_items(node, stanza.attr.from); - if items then - local jids = { [jid] = options or true }; - for id, item in pairs(items) do - service.config.broadcaster("items", node, jids, item); - end - end - end end function handlers.set_unsubscribe(origin, stanza, unsubscribe) -- cgit v1.2.3