X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=tools%2Fejabberd2prosody.lua;h=46a48f57fca2f8acf1d5556ee35ce76cf0c95240;hb=670c0bb01015bf63176eafc5c605c800c7053e1f;hp=590145cdf75cb847d3a818c279631f532d9af154;hpb=d7500b793dfcb85934bc5c42213dc6b393b1a2f6;p=prosody.git diff --git a/tools/ejabberd2prosody.lua b/tools/ejabberd2prosody.lua index 590145cd..46a48f57 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)