mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-12 21:52:07 +02:00
improve error handling when sql calling with (empty|unknown) host.
see #191
This commit is contained in:
parent
ec6c58a21c
commit
0904b8b8ff
|
@ -300,6 +300,9 @@ get_password_with_authmodule(User, Server) ->
|
||||||
|
|
||||||
-spec is_user_exists(binary(), binary()) -> boolean().
|
-spec is_user_exists(binary(), binary()) -> boolean().
|
||||||
|
|
||||||
|
is_user_exists(User, <<"">>) ->
|
||||||
|
false;
|
||||||
|
|
||||||
is_user_exists(User, Server) ->
|
is_user_exists(User, Server) ->
|
||||||
%% Check if the user exists in all authentications module except the module
|
%% Check if the user exists in all authentications module except the module
|
||||||
%% passed as parameter
|
%% passed as parameter
|
||||||
|
|
|
@ -212,7 +212,6 @@ is_user_exists(User, Server) ->
|
||||||
true; %% Account exists
|
true; %% Account exists
|
||||||
{selected, [<<"password">>], []} ->
|
{selected, [<<"password">>], []} ->
|
||||||
false; %% Account does not exist
|
false; %% Account does not exist
|
||||||
{error, unknownhost} -> false;
|
|
||||||
{error, Error} -> {error, Error}
|
{error, Error} -> {error, Error}
|
||||||
catch
|
catch
|
||||||
_:B -> {error, B}
|
_:B -> {error, B}
|
||||||
|
|
|
@ -141,7 +141,7 @@ sql_call(Host, Msg) ->
|
||||||
case get(?STATE_KEY) of
|
case get(?STATE_KEY) of
|
||||||
undefined ->
|
undefined ->
|
||||||
case ejabberd_odbc_sup:get_random_pid(Host) of
|
case ejabberd_odbc_sup:get_random_pid(Host) of
|
||||||
none -> {error, unknownhost};
|
none -> {error, <<"Unknown Host">>};
|
||||||
Pid ->
|
Pid ->
|
||||||
(?GEN_FSM):sync_send_event(Pid,{sql_cmd, Msg, now()},
|
(?GEN_FSM):sync_send_event(Pid,{sql_cmd, Msg, now()},
|
||||||
?TRANSACTION_TIMEOUT)
|
?TRANSACTION_TIMEOUT)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user