diff --git a/debian/patches/0001-mod_mam_disco.path b/debian/patches/0001-mod_mam_disco.path index 2a686cc..fe3f0bd 100644 --- a/debian/patches/0001-mod_mam_disco.path +++ b/debian/patches/0001-mod_mam_disco.path @@ -39,12 +39,10 @@ Change-Id: Ib79b6f2f60f71a80030bbd12b2eb893b60ac025d plugins/mod_mam/mod_mam.lua | 2 ++ 1 file changed, 2 insertions(+) -diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua -index a4aa014..6d1a658 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua -@@ -393,6 +393,8 @@ module:hook("message/bare", message_handler, 2); - module:hook("message/full", message_handler, 2); +@@ -393,6 +393,8 @@ module:hook("message/bare", message_hand + module:hook("message/full", message_handler, 0); module:add_feature(xmlns_mam0); -- COMPAT with XEP-0313 v 0.1 +module:add_feature(xmlns_mam1); -- COMPAT with XEP-0313 v 0.5 diff --git a/plugins/mod_log_auth/mod_log_auth.lua b/plugins/mod_log_auth/mod_log_auth.lua index 0dd607c..49180aa 100644 --- a/plugins/mod_log_auth/mod_log_auth.lua +++ b/plugins/mod_log_auth/mod_log_auth.lua @@ -1,15 +1,19 @@ local mode = module:get_option_string("log_auth_ips", "failure"); -assert(({ all = true, failure = true, success = true })[mode], "Unknown log mode: "..tostring(mode).." - valid modes are 'all', 'failure', 'success'"); +assert(({ all = true, failure = true, success = true })[mode], + "Unknown log mode: "..tostring(mode).." - valid modes are 'all', 'failure', 'success'"); if mode == "failure" or mode == "all" then module:hook("authentication-failure", function (event) - module:log("info", "Failed authentication attempt (%s) for user %s from IP: %s", event.condition or "unknown-condition", event.session.username or "?", event.session.ip or "?"); + local session = event.session; + local username = session.username or session.sasl_handler and session.sasl_handler.username or "?"; + session.log("info", "Failed authentication attempt (%s) for user %s from IP: %s", + event.condition or "unknown-condition", username, session.ip or "?"); end); end if mode == "success" or mode == "all" then module:hook("authentication-success", function (event) local session = event.session; - module:log("info", "Successful authentication as %s from IP: %s", session.username, session.ip or "?"); + session.log("info", "Successful authentication as %s from IP: %s", session.username, session.ip or "?"); end); end diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index a4aa014..0801b09 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -386,11 +386,11 @@ if cleanup_after ~= "never" then end -- Stanzas sent by local clients -module:hook("pre-message/bare", c2s_message_handler, 2); -module:hook("pre-message/full", c2s_message_handler, 2); +module:hook("pre-message/bare", c2s_message_handler, 0); +module:hook("pre-message/full", c2s_message_handler, 0); -- Stanszas to local clients -module:hook("message/bare", message_handler, 2); -module:hook("message/full", message_handler, 2); +module:hook("message/bare", message_handler, 0); +module:hook("message/full", message_handler, 0); module:add_feature(xmlns_mam0); -- COMPAT with XEP-0313 v 0.1 diff --git a/plugins/mod_smacks/mod_smacks.lua b/plugins/mod_smacks/mod_smacks.lua index d37a60c..a01199a 100644 --- a/plugins/mod_smacks/mod_smacks.lua +++ b/plugins/mod_smacks/mod_smacks.lua @@ -49,8 +49,16 @@ local function init_session_cache(max_entries, evict_callback) if not cache then local store = {}; return { - get = function(user, key) return store[key]; end; - set = function(user, key, value) store[key] = value; end; + get = function(user, key) + if not user then return nil; end + if not key then return nil; end + return store[key]; + end; + set = function(user, key, value) + if not user then return nil; end + if not key then return nil; end + store[key] = value; + end; }; end @@ -58,12 +66,16 @@ local function init_session_cache(max_entries, evict_callback) local stores = {}; return { get = function(user, key) + if not user then return nil; end + if not key then return nil; end if not stores[user] then stores[user] = cache.new(max_entries, evict_callback); end return stores[user]:get(key); end; set = function(user, key, value) + if not user then return nil; end + if not key then return nil; end if not stores[user] then stores[user] = cache.new(max_entries, evict_callback); end stores[user]:set(key, value); -- remove empty caches completely @@ -73,7 +85,7 @@ local function init_session_cache(max_entries, evict_callback) end local old_session_registry = init_session_cache(max_old_sessions, nil); local session_registry = init_session_cache(max_hibernated_sessions, function(resumption_token, session) - if session.destroyed then return; end + if session.destroyed then return true; end -- destroyed session can always be removed from cache session.log("warn", "User has too much hibernated sessions, removing oldest session (token: %s)", resumption_token); -- store old session's h values on force delete -- save only actual h value and username/host (for security) @@ -158,15 +170,17 @@ local function request_ack_if_needed(session, force) end end); end - -- Trigger "smacks-ack-delayed"-event if we added new (ackable) stanzas to the outgoing queue - -- and there isn't already a timer for this event running. - -- If we wouldn't do this, stanzas added to the queue after the first "smacks-ack-delayed"-event - -- would not trigger this event (again). - if #queue > max_unacked_stanzas and session.awaiting_ack and session.delayed_ack_timer == nil then - session.log("debug", "Calling delayed_ack_function directly (still waiting for ack)"); - delayed_ack_function(session); - end end + + -- Trigger "smacks-ack-delayed"-event if we added new (ackable) stanzas to the outgoing queue + -- and there isn't already a timer for this event running. + -- If we wouldn't do this, stanzas added to the queue after the first "smacks-ack-delayed"-event + -- would not trigger this event (again). + if #queue > max_unacked_stanzas and session.awaiting_ack and session.delayed_ack_timer == nil then + session.log("debug", "Calling delayed_ack_function directly (still waiting for ack)"); + delayed_ack_function(session); + end + session.last_queue_count = #queue; end diff --git a/prosody-modules.revision b/prosody-modules.revision index 4a9a6a3..07aec10 100644 --- a/prosody-modules.revision +++ b/prosody-modules.revision @@ -1 +1 @@ -2e1a4740adee +9b43b7fc3558