From 6ec3c0bee0f0e657b54551b2f66c7de2a5bda468 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 20 Aug 2015 09:14:15 +0200 Subject: ejabberd2prosody: Support password stored as SCRAM hashes --- tools/ejabberd2prosody.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/ejabberd2prosody.lua b/tools/ejabberd2prosody.lua index af87594e..069b5161 100755 --- a/tools/ejabberd2prosody.lua +++ b/tools/ejabberd2prosody.lua @@ -72,7 +72,22 @@ function vcard(node, host, stanza) print("["..(err or "success").."] vCard: "..node.."@"..host); end function password(node, host, password) - local ret, err = dm.store(node, host, "accounts", {password = password}); + local data = {}; + if type(password) == "string" then + data.password = password; + elseif type(password) == "table" and password[1] == "scram" then + local unb64 = require"mime".unb64; + local function hex(s) + return s:gsub(".", function (c) + return ("%02x"):format(c:byte()); + end); + end + data.stored_key = hex(unb64(password[2])); + data.server_key = hex(unb64(password[3])); + data.salt = unb64(password[4]); + data.iteration_count = password[5]; + end + local ret, err = dm.store(node, host, "accounts", data); print("["..(err or "success").."] accounts: "..node.."@"..host); end function roster(node, host, jid, item) -- cgit v1.2.3 From 4924ad4d8e917d704f510661071ce44ace300948 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 26 Aug 2015 13:08:10 +0200 Subject: mod_admin_adhoc: Import missing util.set (fixes #518) --- plugins/mod_admin_adhoc.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mod_admin_adhoc.lua b/plugins/mod_admin_adhoc.lua index c21a2060..b6163559 100644 --- a/plugins/mod_admin_adhoc.lua +++ b/plugins/mod_admin_adhoc.lua @@ -30,6 +30,7 @@ local modulemanager = require "core.modulemanager"; local core_post_stanza = prosody.core_post_stanza; local adhoc_simple = require "util.adhoc".new_simple_form; local adhoc_initial = require "util.adhoc".new_initial_data_form; +local set = require"util.set"; module:depends("adhoc"); local adhoc_new = module:require "adhoc".new; -- cgit v1.2.3 From 88f902f1e981d9230d9bb9597fb3ef58c488f1fc Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 26 Aug 2015 13:08:51 +0200 Subject: mod_admin_adhoc: Declare local variable, don't set a global [luacheck] --- plugins/mod_admin_adhoc.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mod_admin_adhoc.lua b/plugins/mod_admin_adhoc.lua index b6163559..fdbdf462 100644 --- a/plugins/mod_admin_adhoc.lua +++ b/plugins/mod_admin_adhoc.lua @@ -614,6 +614,7 @@ end, function(fields, err) end); local function send_to_online(message, server) + local sessions; if server then sessions = { [server] = hosts[server] }; else -- cgit v1.2.3