aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ejabberd2prosody.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2021-10-07 13:02:28 +0100
committerMatthew Wild <mwild1@gmail.com>2021-10-07 13:02:28 +0100
commit8660ec61ce506c687402c942972c5fa42a417b6d (patch)
treee02b52bd7eefa71d67efeb6b0cec4c4a0453dc74 /tools/ejabberd2prosody.lua
parent7925b95a586b5d347c091249c1b0f2d86d99be01 (diff)
downloadprosody-8660ec61ce506c687402c942972c5fa42a417b6d.tar.gz
prosody-8660ec61ce506c687402c942972c5fa42a417b6d.zip
prosody2ejabberd: Check for iteration count at position 6
In some data dumps, presumably from newer ejabberd versions, position 5 is the string "sha", and the iteration count follows it.
Diffstat (limited to 'tools/ejabberd2prosody.lua')
-rwxr-xr-xtools/ejabberd2prosody.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/ejabberd2prosody.lua b/tools/ejabberd2prosody.lua
index 6aef1ff2..8b95aaef 100755
--- a/tools/ejabberd2prosody.lua
+++ b/tools/ejabberd2prosody.lua
@@ -85,7 +85,13 @@ function password(node, host, password)
data.stored_key = hex(unb64(password[2]));
data.server_key = hex(unb64(password[3]));
data.salt = unb64(password[4]);
- data.iteration_count = tonumber(password[5]);
+ if type(password[6]) == "number" then
+ assert(password[5] == "sha", "unexpected passwd entry hash: "..tostring(password[5]));
+ data.iteration_count = password[6];
+ else
+ assert(type(password[5]) == "number", "unexpected passwd entry in source data");
+ data.iteration_count = password[5];
+ end
end
local ret, err = dm.store(node, host, "accounts", data);
print("["..(err or "success").."] accounts: "..node.."@"..host);