summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_access_control.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rabbit_access_control.erl b/src/rabbit_access_control.erl
index 46f882c378..c747a4531d 100644
--- a/src/rabbit_access_control.erl
+++ b/src/rabbit_access_control.erl
@@ -132,7 +132,10 @@ check_vhost_access(User = #user{ username = Username,
auth_backend = Module }, VHostPath) ->
?LOGDEBUG("Checking VHost access for ~p to ~p~n", [Username, VHostPath]),
check_access(
- fun() -> Module:check_vhost_access(User, VHostPath, write) end,
+ fun() ->
+ vhost_exists(VHostPath) andalso
+ Module:check_vhost_access(User, VHostPath, write)
+ end,
"~s failed checking vhost access to ~s for ~s: ~p~n",
[Module, VHostPath, Username],
"access to vhost '~s' refused for user '~s'",