-local function password_callback(node, host, mechanism, decoder)
- local password = (datamanager_load(node, host, "accounts") or {}).password; -- FIXME handle hashed passwords
- local func = function(x) return x; end;
- if password then
- if mechanism == "PLAIN" then
- return func, password;
- elseif mechanism == "DIGEST-MD5" then
- if decoder then node, host, password = decoder(node), decoder(host), decoder(password); end
- return func, md5(node..":"..host..":"..password);
- end
- end
- return func, nil;
-end
-