]> granicus.if.org Git - ejabberd/commitdiff
improve error handling when sql calling with (empty|unknown) host.
authorHAMANO Tsukasa <hamano@cuspy.org>
Wed, 30 Apr 2014 15:20:58 +0000 (00:20 +0900)
committerHAMANO Tsukasa <hamano@cuspy.org>
Wed, 30 Apr 2014 15:20:58 +0000 (00:20 +0900)
see #191

src/ejabberd_auth.erl
src/ejabberd_auth_odbc.erl
src/ejabberd_odbc.erl

index bf399af28288ce3d30084e2fab9d646a304b793d..477926f6edaa3a22db3fe1f005d5f5a0c6b98b00 100644 (file)
@@ -300,6 +300,9 @@ get_password_with_authmodule(User, Server) ->
 
 -spec is_user_exists(binary(), binary()) -> boolean().
 
+is_user_exists(User, <<"">>) ->
+    false;
+
 is_user_exists(User, Server) ->
 %% Check if the user exists in all authentications module except the module
 %% passed as parameter
index 27e89aa2bd09aad738d947fa20fefb478ee07d63..57cef930a6b6cf46fd762147f4758040ec0ae7aa 100644 (file)
@@ -212,7 +212,6 @@ is_user_exists(User, Server) ->
                true; %% Account exists
            {selected, [<<"password">>], []} ->
                false; %% Account does not exist
-           {error, unknownhost} -> false;
            {error, Error} -> {error, Error}
          catch
            _:B -> {error, B}
index df9a4c39895cb5df03a6be3e24bc392e8c6070c1..2b852bfaaa7485d9ba4ebd3a143080b89278cab2 100644 (file)
@@ -141,7 +141,7 @@ sql_call(Host, Msg) ->
     case get(?STATE_KEY) of
       undefined ->
         case ejabberd_odbc_sup:get_random_pid(Host) of
-          none -> {error, unknownhost};
+          none -> {error, <<"Unknown Host">>};
           Pid ->
             (?GEN_FSM):sync_send_event(Pid,{sql_cmd, Msg, now()},
                                        ?TRANSACTION_TIMEOUT)