Software /
code /
prosody
Comparison
tools/ejabberd2prosody.lua @ 11842:c20ff585e966
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.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 07 Oct 2021 13:02:28 +0100 |
parent | 11841:94534717ffca |
child | 11849:7440d610e5f1 |
comparison
equal
deleted
inserted
replaced
11841:94534717ffca | 11842:c20ff585e966 |
---|---|
83 end); | 83 end); |
84 end | 84 end |
85 data.stored_key = hex(unb64(password[2])); | 85 data.stored_key = hex(unb64(password[2])); |
86 data.server_key = hex(unb64(password[3])); | 86 data.server_key = hex(unb64(password[3])); |
87 data.salt = unb64(password[4]); | 87 data.salt = unb64(password[4]); |
88 data.iteration_count = tonumber(password[5]); | 88 if type(password[6]) == "number" then |
89 assert(password[5] == "sha", "unexpected passwd entry hash: "..tostring(password[5])); | |
90 data.iteration_count = password[6]; | |
91 else | |
92 assert(type(password[5]) == "number", "unexpected passwd entry in source data"); | |
93 data.iteration_count = password[5]; | |
94 end | |
89 end | 95 end |
90 local ret, err = dm.store(node, host, "accounts", data); | 96 local ret, err = dm.store(node, host, "accounts", data); |
91 print("["..(err or "success").."] accounts: "..node.."@"..host); | 97 print("["..(err or "success").."] accounts: "..node.."@"..host); |
92 end | 98 end |
93 function roster(node, host, jid, item) | 99 function roster(node, host, jid, item) |