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