aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ejabberd2prosody.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-08-26 13:17:10 +0200
committerKim Alvefur <zash@zash.se>2015-08-26 13:17:10 +0200
commit0049dd0d5f58affe39b8acb0ae460bbd42ec4a8f (patch)
tree43e0dccc1f6c698ab696b20b09b4e7a606ca9527 /tools/ejabberd2prosody.lua
parent33f35bae5816a63050a4825233acc3c630e0a1b2 (diff)
parent37438ca56edd972e4e5cbea24cd12066c12e7dee (diff)
downloadprosody-0049dd0d5f58affe39b8acb0ae460bbd42ec4a8f.tar.gz
prosody-0049dd0d5f58affe39b8acb0ae460bbd42ec4a8f.zip
Merge 0.9->0.10
Diffstat (limited to 'tools/ejabberd2prosody.lua')
-rwxr-xr-xtools/ejabberd2prosody.lua17
1 files changed, 16 insertions, 1 deletions
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)