From b73fce8d46e187ce41712346b49e6778cca135a9 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 1 Mar 2010 16:02:59 +0000 Subject: mod_saslauth: Unlock globals while loading cyrus --- plugins/mod_saslauth.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins') diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index 0f4c8b4b..0f809bd8 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -36,7 +36,9 @@ local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; local new_sasl; if sasl_backend == "cyrus" then + prosody.unlock_globals(); local ok, cyrus = pcall(require, "util.sasl_cyrus"); + prosody.lock_globals(); if ok then local cyrus_new = cyrus.new; new_sasl = function(realm) -- cgit v1.2.3 From bd1934e306403d34aec93682f290fd06c0784348 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 1 Mar 2010 16:23:26 +0000 Subject: mod_saslauth: Add FIXME to remind myself to fix this as soon as I have time --- 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 0f809bd8..0cae5833 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -36,7 +36,8 @@ local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; local new_sasl; if sasl_backend == "cyrus" then - prosody.unlock_globals(); + prosody.unlock_globals(); --FIXME: Figure out why this is needed and + -- why cyrussasl isn't caught by the sandbox local ok, cyrus = pcall(require, "util.sasl_cyrus"); prosody.lock_globals(); if ok then -- cgit v1.2.3 From 8db085eb2976736ab1ef118b203d2832c3107334 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 1 Mar 2010 18:07:37 +0000 Subject: mod_proxy65: Fix for old-style closing of connections (another source of tracebacks with libevent enabled) --- plugins/mod_proxy65.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_proxy65.lua b/plugins/mod_proxy65.lua index 2cfbe7b6..5c9ae329 100644 --- a/plugins/mod_proxy65.lua +++ b/plugins/mod_proxy65.lua @@ -91,12 +91,12 @@ function connlistener.onincoming(conn, data) conn:lock_read(true) else module:log("warn", "Neither data transfer nor initial connect of a participator of a transfer.") - conn.close(); + conn:close(); end else if data ~= nil then module:log("warn", "unknown connection with no authentication data -> closing it"); - conn.close(); + conn:close(); end end end @@ -107,9 +107,9 @@ function connlistener.ondisconnect(conn, err) if session.sha and transfers[session.sha] then local initiator, target = transfers[session.sha].initiator, transfers[session.sha].target; if initiator == conn and target ~= nil then - target.close(); + target:close(); elseif target == conn and initiator ~= nil then - initiator.close(); + initiator:close(); end transfers[session.sha] = nil; end -- cgit v1.2.3 From 08ee982159bc6f4c83b9d9abef1ee39933e95a17 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Tue, 2 Mar 2010 14:08:32 +0500 Subject: mod_offline: Convert to Unix line endings. --- plugins/mod_offline.lua | 94 ++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_offline.lua b/plugins/mod_offline.lua index c74d011e..24aef9ed 100644 --- a/plugins/mod_offline.lua +++ b/plugins/mod_offline.lua @@ -6,51 +6,51 @@ -- COPYING file in the source package for more information. -- - -local datamanager = require "util.datamanager"; -local st = require "util.stanza"; -local datetime = require "util.datetime"; + +local datamanager = require "util.datamanager"; +local st = require "util.stanza"; +local datetime = require "util.datetime"; local ipairs = ipairs; -local jid_split = require "util.jid".split; - -module:add_feature("msgoffline"); - -module:hook("message/offline/store", function(event) - local origin, stanza = event.origin, event.stanza; - local to = stanza.attr.to; - local node, host; - if to then - node, host = jid_split(to) - else - node, host = origin.username, origin.host; - end - - stanza.attr.stamp, stanza.attr.stamp_legacy = datetime.datetime(), datetime.legacy(); - local result = datamanager.list_append(node, host, "offline", st.preserialize(stanza)); - stanza.attr.stamp, stanza.attr.stamp_legacy = nil, nil; - - return true; -end); - -module:hook("message/offline/broadcast", function(event) - local origin = event.origin; - local node, host = origin.username, origin.host; - - local data = datamanager.list_load(node, host, "offline"); - if not data then return true; end - for _, stanza in ipairs(data) do - stanza = st.deserialize(stanza); - stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = host, stamp = stanza.attr.stamp}):up(); -- XEP-0203 - stanza:tag("x", {xmlns = "jabber:x:delay", from = host, stamp = stanza.attr.stamp_legacy}):up(); -- XEP-0091 (deprecated) - stanza.attr.stamp, stanza.attr.stamp_legacy = nil, nil; - origin.send(stanza); - end - return true; -end); - -module:hook("message/offline/delete", function(event) - local origin = event.origin; - local node, host = origin.username, origin.host; - - return datamanager.list_store(node, host, "offline", nil); -end); +local jid_split = require "util.jid".split; + +module:add_feature("msgoffline"); + +module:hook("message/offline/store", function(event) + local origin, stanza = event.origin, event.stanza; + local to = stanza.attr.to; + local node, host; + if to then + node, host = jid_split(to) + else + node, host = origin.username, origin.host; + end + + stanza.attr.stamp, stanza.attr.stamp_legacy = datetime.datetime(), datetime.legacy(); + local result = datamanager.list_append(node, host, "offline", st.preserialize(stanza)); + stanza.attr.stamp, stanza.attr.stamp_legacy = nil, nil; + + return true; +end); + +module:hook("message/offline/broadcast", function(event) + local origin = event.origin; + local node, host = origin.username, origin.host; + + local data = datamanager.list_load(node, host, "offline"); + if not data then return true; end + for _, stanza in ipairs(data) do + stanza = st.deserialize(stanza); + stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = host, stamp = stanza.attr.stamp}):up(); -- XEP-0203 + stanza:tag("x", {xmlns = "jabber:x:delay", from = host, stamp = stanza.attr.stamp_legacy}):up(); -- XEP-0091 (deprecated) + stanza.attr.stamp, stanza.attr.stamp_legacy = nil, nil; + origin.send(stanza); + end + return true; +end); + +module:hook("message/offline/delete", function(event) + local origin = event.origin; + local node, host = origin.username, origin.host; + + return datamanager.list_store(node, host, "offline", nil); +end); -- cgit v1.2.3