Changeset

13766:b11242656300

Merge 13.0->trunk
author Matthew Wild <mwild1@gmail.com>
date Tue, 11 Mar 2025 18:45:23 +0000
parents 13759:1437d8884899 (current diff) 13765:7c57fb2ffbb0 (diff)
children 13771:5f26164c738f
files
diffstat 7 files changed, 56 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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;
 		});
--- 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;
--- 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);
--- 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, <stream:error> 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 "<unknown>", reason_text or "session closed");
 
 		-- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> 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
 
--- 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);
--- 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("^([^=]+)=(.+)$");