diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2012-09-10 15:22:27 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2012-09-10 15:22:27 +0100 |
| commit | d893c71442696f854a3e50f8af872c2c7d475efe (patch) | |
| tree | 6ad2221b4b782cc5b9fbe222ed6641f375c4aecf /src | |
| parent | 55c32ad3b6cb2755b524de72594a378b87884057 (diff) | |
| download | rabbitmq-server-git-d893c71442696f854a3e50f8af872c2c7d475efe.tar.gz | |
Rename
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_channel.erl | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 23a80cf100..2a08278138 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 |
