# HG changeset patch # User Matthew Wild # Date 1741718723 0 # Node ID b112426563005ddd77e84c71857a715b22739743 # Parent 1437d888489911fc1f94d47c2418f38297e5e573# Parent 7c57fb2ffbb0a355c3498b88e036199968b2cb42 Merge 13.0->trunk diff -r 1437d8884899 -r b11242656300 CHANGES --- a/CHANGES Thu Mar 06 13:34:55 2025 +0000 +++ b/CHANGES Tue Mar 11 18:45:23 2025 +0000 @@ -6,6 +6,15 @@ ## New +## Modules + +- mod_account_activity +- mod_cloud_notify +- mod_flags +- mod_http_altconnect +- mod_s2s_auth_dane_in +- mod_server_info + ### Administration - Add 'watch log' command to follow live debug logs at runtime (even if disabled) diff -r 1437d8884899 -r b11242656300 core/usermanager.lua --- a/core/usermanager.lua Thu Mar 06 13:34:55 2025 +0000 +++ b/core/usermanager.lua Tue Mar 11 18:45:23 2025 +0000 @@ -109,6 +109,7 @@ local function set_password(username, password, host, resource) local ok, err = hosts[host].users.set_password(username, password); if ok then + log("info", "Account password changed: %s@%s", username, host); prosody.events.fire_event("user-password-changed", { username = username, host = host, resource = resource }); end return ok, err; @@ -126,12 +127,17 @@ end local function create_user(username, password, host) - return hosts[host].users.create_user(username, password); + local ok, err = hosts[host].users.create_user(username, password); + if ok then + log("info", "User account created: %s@%s", username, host); + end + return ok, err; end local function delete_user(username, host) local ok, err = hosts[host].users.delete_user(username); if not ok then return nil, err; end + log("info", "User account deleted: %s@%s", username, host); prosody.events.fire_event("user-deleted", { username = username, host = host }); return storagemanager.purge(username, host); end @@ -158,6 +164,7 @@ if not method then return nil, "method not supported"; end local ret, err = method(username); if ret then + log("info", "User account enabled: %s@%s", username, host); prosody.events.fire_event("user-enabled", { username = username, host = host }); end return ret, err; @@ -168,6 +175,7 @@ if not method then return nil, "method not supported"; end local ret, err = method(username, meta); if ret then + log("info", "User account disabled: %s@%s", username, host); prosody.events.fire_event("user-disabled", { username = username, host = host, meta = meta }); end return ret, err; @@ -198,6 +206,7 @@ local role, err = hosts[host].authz.set_user_role(user, role_name); if role then + log("info", "Account %s@%s role changed to %s", user, host, role_name); prosody.events.fire_event("user-role-changed", { username = user, host = host, role = role; }); diff -r 1437d8884899 -r b11242656300 plugins/mod_c2s.lua --- a/plugins/mod_c2s.lua Thu Mar 06 13:34:55 2025 +0000 +++ b/plugins/mod_c2s.lua Tue Mar 11 18:45:23 2025 +0000 @@ -252,12 +252,16 @@ if not session.destroyed then session.log("warn", "Failed to receive a stream close response, closing connection anyway..."); sm_destroy_session(session, reason_text); - if conn then conn:close(); end + if conn then + conn:close(); + end end end); else sm_destroy_session(session, reason_text); - if conn then conn:close(); end + if conn then + conn:close(); + end end else local reason_text = (reason and (reason.name or reason.text or reason.condition)) or reason; diff -r 1437d8884899 -r b11242656300 plugins/mod_storage_internal.lua --- a/plugins/mod_storage_internal.lua Thu Mar 06 13:34:55 2025 +0000 +++ b/plugins/mod_storage_internal.lua Tue Mar 11 18:45:23 2025 +0000 @@ -4,7 +4,7 @@ local datetime = require "prosody.util.datetime"; local st = require "prosody.util.stanza"; local now = require "prosody.util.time".now; -local id = require "prosody.util.id".medium; +local uuid_v7 = require "prosody.util.uuid".v7; local jid_join = require "prosody.util.jid".join; local set = require "prosody.util.set"; local it = require "prosody.util.iterators"; @@ -111,7 +111,7 @@ module:log("debug", "%s reached or over quota, not adding to store", username); return nil, "quota-limit"; end - key = id(); + key = uuid_v7(); end module:log("debug", "%s has %d items out of %d limit in store %s", username, item_count, archive_item_limit, self.store); diff -r 1437d8884899 -r b11242656300 plugins/mod_websocket.lua --- a/plugins/mod_websocket.lua Thu Mar 06 13:34:55 2025 +0000 +++ b/plugins/mod_websocket.lua Tue Mar 11 18:45:23 2025 +0000 @@ -87,6 +87,7 @@ end end end + stream_error = tostring(stream_error); log("debug", "Disconnecting client, is: %s", stream_error); session.send(stream_error); end @@ -94,28 +95,33 @@ session.send(st.stanza("close", { xmlns = xmlns_framing })); function session.send() return false; end - -- luacheck: ignore 422/reason - -- FIXME reason should be handled in common place - local reason = (reason and (reason.name or reason.text or reason.condition)) or reason; - session.log("debug", "c2s stream for %s closed: %s", session.full_jid or ("<"..session.ip..">"), reason or "session closed"); + local reason_text = (reason and (reason.name or reason.text or reason.condition)) or reason; + session.log("debug", "c2s stream for %s closed: %s", session.full_jid or session.ip or "", reason_text or "session closed"); -- Authenticated incoming stream may still be sending us stanzas, so wait for from remote local conn = session.conn; - if reason == nil and not session.notopen and session.type == "c2s" then + if reason_text == nil and not session.notopen and session.type == "c2s" then -- Grace time to process data from authenticated cleanly-closed stream add_task(stream_close_timeout, function () if not session.destroyed then session.log("warn", "Failed to receive a stream close response, closing connection anyway..."); - sm_destroy_session(session, reason); - conn:write(build_close(1000, "Stream closed")); - conn:close(); + sm_destroy_session(session, reason_text); + if conn then + conn:write(build_close(1000, "Stream closed")); + conn:close(); + end end end); else - sm_destroy_session(session, reason); - conn:write(build_close(1000, "Stream closed")); - conn:close(); + sm_destroy_session(session, reason_text); + if conn then + conn:write(build_close(1000, "Stream closed")); + conn:close(); + end end + else + local reason_text = (reason and (reason.name or reason.text or reason.condition)) or reason; + sm_destroy_session(session, reason_text); end end diff -r 1437d8884899 -r b11242656300 spec/util_argparse_spec.lua --- a/spec/util_argparse_spec.lua Thu Mar 06 13:34:55 2025 +0000 +++ b/spec/util_argparse_spec.lua Tue Mar 11 18:45:23 2025 +0000 @@ -54,6 +54,12 @@ assert.same({ foo = "bar"; baz = "moo" }, opts); end); + it("supports value arguments in strict mode", function() + local opts, err = parse({ "--foo"; "bar"; "--baz=moo" }, { strict = true, value_params = { foo = true; baz = true } }); + assert.falsy(err); + assert.same({ foo = "bar"; baz = "moo" }, opts); + end); + it("demands values for value params", function() local opts, err, where = parse({ "--foo" }, { value_params = { foo = true } }); assert.falsy(opts); diff -r 1437d8884899 -r b11242656300 util/argparse.lua --- a/util/argparse.lua Thu Mar 06 13:34:55 2025 +0000 +++ b/util/argparse.lua Tue Mar 11 18:45:23 2025 +0000 @@ -39,9 +39,13 @@ local param_k, param_v; if value_params[uparam] or array_params[uparam] then - param_k, param_v = uparam, table.remove(arg, 1); + param_k = uparam; + param_v = param:match("^=(.*)$", #uparam+1); if not param_v then - return nil, "missing-value", raw_param; + param_v = table.remove(arg, 1); + if not param_v then + return nil, "missing-value", raw_param; + end end else param_k, param_v = param:match("^([^=]+)=(.+)$");