Diff

mod_client_certs/mod_client_certs.lua @ 6055:23c4c61a1068

mod_muc_gateway_optimize: New module to optimize muc presence to remote gateways Some gateways are happy to receive presence for each participant in MUCs that they are in only once, to any one of their joined JIDs.
author Stephen Paul Weber <singpolyma@singpolyma.net>
date Sun, 17 Nov 2024 22:32:52 -0500
parent 3447:5f2eeebcf899
line wrap: on
line diff
--- a/mod_client_certs/mod_client_certs.lua	Mon Nov 11 23:33:01 2024 +0100
+++ b/mod_client_certs/mod_client_certs.lua	Sun Nov 17 22:32:52 2024 -0500
@@ -10,7 +10,7 @@
 local dm_load = require "util.datamanager".load;
 local dm_store = require "util.datamanager".store;
 local dm_table = "client_certs";
-local ssl_x509 = require "ssl.x509";
+local ssl = require "ssl";
 local util_x509 = require "util.x509";
 local id_on_xmppAddr = "1.3.6.1.5.5.7.8.5";
 local id_ce_subjectAltName = "2.5.29.17";
@@ -141,7 +141,7 @@
 	local can_manage = append:get_child("no-cert-management", xmlns_saslcert) ~= nil;
 	x509cert = x509cert:gsub("^%s*(.-)%s*$", "%1");
 
-	local cert = ssl_x509.load(util_x509.der2pem(base64.decode(x509cert)));
+	local cert = ssl.loadcertificate(util_x509.der2pem(base64.decode(x509cert)));
 
 	if not cert then
 		origin.send(st.error_reply(stanza, "modify", "not-acceptable", "Could not parse X.509 certificate"));
@@ -206,8 +206,8 @@
 	instructions = "What action do you want to perform?";
 
 	{ name = "FORM_TYPE", type = "hidden", value = "http://prosody.im/protocol/certs#subcmd" };
-	{ name = "subcmd", type = "list-single", label = "Actions", required = true,
-		value = { {label = "Add certificate", value = "add"},
+	{ name = "subcmd", type = "list-single", label = "Actions", required = false,
+		options = { {label = "Add certificate", value = "add"},
 			  {label = "List certificates", value = "list"},
 			  {label = "Disable certificate", value = "disable"},
 			  {label = "Revoke certificate", value = "revoke"},
@@ -292,7 +292,7 @@
 		local name = fields.name;
 		local x509cert = fields.cert:gsub("^%s*(.-)%s*$", "%1");
 
-		local cert = ssl_x509.load(util_x509.der2pem(base64.decode(x509cert)));
+		local cert = ssl.loadcertificate(x509cert);
 
 		if not cert then
 			return { status = "completed", error = { message = "Could not parse X.509 certificate" } };
@@ -327,7 +327,7 @@
 	end
 end
 
-local cmd_desc = adhoc_new("Manage certificates", "http://prosody.im/protocol/certs", adhoc_handler, "user");
+local cmd_desc = adhoc_new("Manage certificates", "http://prosody.im/protocol/certs", adhoc_handler, "any");
 module:provides("adhoc", cmd_desc);
 
 -- Here comes the SASL EXTERNAL stuff