summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-09-10 15:22:27 +0100
committerSimon MacMullen <simon@rabbitmq.com>2012-09-10 15:22:27 +0100
commit9c95750053cb70063fd948d958358b3c468aee04 (patch)
tree6ad2221b4b782cc5b9fbe222ed6641f375c4aecf
parentc2c071a28c47e529e907ac687334515b3d4cf5e2 (diff)
downloadrabbitmq-server-9c95750053cb70063fd948d958358b3c468aee04.tar.gz
Rename
-rw-r--r--src/rabbit_channel.erl28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 23a80cf1..2a082781 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -459,28 +459,28 @@ check_write_permitted(Resource, #ch{user = User}) ->
check_read_permitted(Resource, #ch{user = User}) ->
check_resource_access(User, Resource, read).
-check_user_id_header(Props = #'P_basic'{user_id = undefined}, _) ->
+check_internal_exchange(#exchange{name = Name, internal = true}) ->
+ rabbit_misc:protocol_error(access_refused,
+ "cannot publish to internal ~s",
+ [rabbit_misc:rs(Name)]);
+check_internal_exchange(_) ->
+ ok.
+
+ensure_user_id_header(Props = #'P_basic'{user_id = undefined}, _) ->
Props;
%% We rely on the fact that the codec can't express this. So we must
%% be talking to the direct client, which can do anything anyway.
-check_user_id_header(Props = #'P_basic'{user_id = {trust, Username}}, _) ->
+ensure_user_id_header(Props = #'P_basic'{user_id = {trust, Username}}, _) ->
Props#'P_basic'{user_id = Username};
-check_user_id_header(Props = #'P_basic'{user_id = Username},
- #ch{user = #user{username = Username}}) ->
+ensure_user_id_header(Props = #'P_basic'{user_id = Username},
+ #ch{user = #user{username = Username}}) ->
Props;
-check_user_id_header(#'P_basic'{user_id = Claimed},
- #ch{user = #user{username = Actual}}) ->
+ensure_user_id_header(#'P_basic'{user_id = Claimed},
+ #ch{user = #user{username = Actual}}) ->
precondition_failed(
"user_id property set to '~s' but authenticated user was '~s'",
[Claimed, Actual]).
-check_internal_exchange(#exchange{name = Name, internal = true}) ->
- rabbit_misc:protocol_error(access_refused,
- "cannot publish to internal ~s",
- [rabbit_misc:rs(Name)]);
-check_internal_exchange(_) ->
- ok.
-
expand_queue_name_shortcut(<<>>, #ch{most_recently_declared_queue = <<>>}) ->
rabbit_misc:protocol_error(
not_found, "no previously declared queue", []);
@@ -615,7 +615,7 @@ handle_method(#'basic.publish'{exchange = ExchangeNameBin,
DecodedContent0 = rabbit_binary_parser:ensure_content_decoded(Content),
DecodedContent =
DecodedContent0#content{
- properties = check_user_id_header(
+ properties = ensure_user_id_header(
DecodedContent0#content.properties, State)},
{MsgSeqNo, State1} =
case {TxStatus, ConfirmEnabled} of