diff options
author | Kim Alvefur <zash@zash.se> | 2015-08-20 09:14:15 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-08-20 09:14:15 +0200 |
commit | 37438ca56edd972e4e5cbea24cd12066c12e7dee (patch) | |
tree | 41b08a0a8a70c39e2bc5d5765b551f89cebb2fd7 | |
parent | 5243ae5fee6f0428a378691033a950cc9db0595a (diff) | |
download | prosody-37438ca56edd972e4e5cbea24cd12066c12e7dee.tar.gz prosody-37438ca56edd972e4e5cbea24cd12066c12e7dee.zip |
ejabberd2prosody: Support password stored as SCRAM hashes
-rwxr-xr-x | tools/ejabberd2prosody.lua | 17 |
1 files changed, 16 insertions, 1 deletions
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) |