diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-02-11 10:50:47 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-02-11 10:50:47 +0000 |
commit | 5603ec407a6cee2cd9bcac6c60b0f228c398244e (patch) | |
tree | 7bbeb9f42daf6e2033a2efe8c19477d75064d7b2 | |
parent | 9b22b0165ae290af06144e438dff00a1c1fb860e (diff) | |
download | rabbitmq-server-bug25985.tar.gz |
Allow username without password after all.bug25985
-rw-r--r-- | src/rabbit_direct.erl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/rabbit_direct.erl b/src/rabbit_direct.erl index 267b581d..227fe1c6 100644 --- a/src/rabbit_direct.erl +++ b/src/rabbit_direct.erl @@ -31,7 +31,7 @@ -spec(force_event_refresh/0 :: () -> 'ok'). -spec(list/0 :: () -> [pid()]). -spec(list_local/0 :: () -> [pid()]). --spec(connect/5 :: (('nouser' | +-spec(connect/5 :: (({'none', 'none'} | {rabbit_types:username(), 'none'} | {rabbit_types:username(), rabbit_types:password()}), rabbit_types:vhost(), rabbit_types:protocol(), pid(), rabbit_event:event_props()) -> @@ -67,13 +67,17 @@ list() -> %%---------------------------------------------------------------------------- +connect({none, _}, VHost, Protocol, Pid, Infos) -> + connect0(fun () -> {ok, rabbit_auth_backend_dummy:user()} end, + VHost, Protocol, Pid, Infos); + +connect({Username, none}, VHost, Protocol, Pid, Infos) -> + connect0(fun () -> rabbit_access_control:check_user_login(Username, []) end, + VHost, Protocol, Pid, Infos); + connect({Username, Password}, VHost, Protocol, Pid, Infos) -> connect0(fun () -> rabbit_access_control:check_user_pass_login( Username, Password) end, - VHost, Protocol, Pid, Infos); - -connect(nouser, VHost, Protocol, Pid, Infos) -> - connect0(fun () -> {ok, rabbit_auth_backend_dummy:user()} end, VHost, Protocol, Pid, Infos). connect0(AuthFun, VHost, Protocol, Pid, Infos) -> |