# HG changeset patch # User Matthew Wild # Date 1633608148 -3600 # Node ID c20ff585e966195d6a594f52dd49b60903510af4 # Parent 94534717ffcab95f1546662a277af8625fd3f8ad 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. diff -r 94534717ffca -r c20ff585e966 tools/ejabberd2prosody.lua --- a/tools/ejabberd2prosody.lua Thu Oct 07 11:16:46 2021 +0100 +++ b/tools/ejabberd2prosody.lua Thu Oct 07 13:02:28 2021 +0100 @@ -85,7 +85,13 @@ 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);