diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2011-05-03 15:33:33 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2011-05-03 15:33:33 +0100 |
commit | b50b5fe89b3a96a8d22c24586cc9ad1eed89425e (patch) | |
tree | 119ea7a65a71384993cc889db1d20f6fb2f281f9 | |
parent | c75b4aaebf0fb1ade23f4fb501584f27acc8c829 (diff) | |
download | rabbitmq-server-b50b5fe89b3a96a8d22c24586cc9ad1eed89425e.tar.gz |
Separate out different types for network and direct connections, don't check the password for direct ones.
-rw-r--r-- | src/rabbit_direct.erl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/rabbit_direct.erl b/src/rabbit_direct.erl index 0dac18d1..7ad63e81 100644 --- a/src/rabbit_direct.erl +++ b/src/rabbit_direct.erl @@ -16,7 +16,7 @@ -module(rabbit_direct). --export([boot/0, connect/5, start_channel/8, disconnect/1]). +-export([boot/0, connect/4, start_channel/8, disconnect/1]). -include("rabbit.hrl"). @@ -25,7 +25,7 @@ -ifdef(use_specs). -spec(boot/0 :: () -> 'ok'). --spec(connect/5 :: (binary(), binary(), binary(), rabbit_types:protocol(), +-spec(connect/4 :: (binary(), binary(), rabbit_types:protocol(), rabbit_event:event_props()) -> {'ok', {rabbit_types:user(), rabbit_framing:amqp_table()}}). @@ -53,11 +53,11 @@ boot() -> %%---------------------------------------------------------------------------- -connect(Username, Password, VHost, Protocol, Infos) -> +connect(Username, VHost, Protocol, Infos) -> case lists:keymember(rabbit, 1, application:which_applications()) of true -> - try rabbit_access_control:user_pass_login(Username, Password) of - #user{} = User -> + case rabbit_access_control:check_user_login(Username, []) of + {ok, User} -> try rabbit_access_control:check_vhost_access(User, VHost) of ok -> rabbit_event:notify(connection_created, Infos), {ok, {User, @@ -65,9 +65,9 @@ connect(Username, Password, VHost, Protocol, Infos) -> catch exit:#amqp_error{name = access_refused} -> {error, access_refused} - end - catch - exit:#amqp_error{name = access_refused} -> {error, auth_failure} + end; + {refused, _Msg, _Args} -> + {error, auth_failure} end; false -> {error, broker_not_found_on_node} |