今天对ejabberd服务器做了一个小小的测试,发现后台抛出
=ERROR REPORT==== 2011-03-29 16:53:30 ===
E(<0.18276.0>:ejabberd_auth:256) : The authentication module ejabberd_auth_odbc returned an error
when checking user "server_test_user_65475" in server "servertest.igrslabdns.com"
Error message: {noproc,
{p1_fsm,sync_send_event,
[<0.12307.1>,
{sql_cmd,
{sql_query,
["select password from users where username='",
"server_test_user_65475","';"]},
{1301,383421,845044}},
60000]}}
case ejabberd_auth:is_user_exists(LUser, LServer) of true -> is_privacy_allow(From, To, Packet) andalso ejabberd_hooks:run(offline_message_hook, LServer, [From, To, Packet]); _ -> Err = jlib:make_error_reply( Packet, ?ERR_SERVICE_UNAVAILABLE), ejabberd_router:route(To, From, Err) end
%% Returns true if the user exists in the DB or if an anonymous user is logged %% under the given name is_user_exists(User, Server) -> lists:any( fun(M) -> case M:is_user_exists(User, Server) of {error, Error} -> ?ERROR_MSG("The authentication module ~p returned an " "error~nwhen checking user ~p in server ~p~n" "Error message: ~p", [M, User, Server, Error]), false; Else -> Else end end, auth_modules(Server)).
%% @spec (User, Server) -> true | false | {error, Error} is_user_exists(User, Server) -> case jlib:nodeprep(User) of error -> false; LUser -> Username = ejabberd_odbc:escape(LUser), LServer = jlib:nameprep(Server), try odbc_queries:get_password(LServer, Username) of {selected, ["password"], [{_Password}]} -> true; %% Account exists {selected, ["password"], []} -> false; %% Account does not exist {error, Error} -> {error, Error} %% Typical error is that table doesn't exist catch _:B -> {error, B} %% Typical error is database not accessible end end.