summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2019-03-14 14:28:15 +0300
committerMichael Klishin <michael@clojurewerkz.org>2019-03-14 14:28:15 +0300
commit7b71da6e9e0b5c9bd7fc3485fbb7cf2150516cff (patch)
tree86fe02cdb69bb6a2961d88549414ac32cf91e1d2 /src
parented70fa442346c5b026b559a6bfbb19a2120bd2e3 (diff)
parentf18fdcecf9322c446e0082e774decd26100bc956 (diff)
downloadrabbitmq-server-git-7b71da6e9e0b5c9bd7fc3485fbb7cf2150516cff.tar.gz
Merge branch 'thedrow-patch-1'
Closes #1914.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_auth_mechanism_amqplain.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/rabbit_auth_mechanism_amqplain.erl b/src/rabbit_auth_mechanism_amqplain.erl
index 6ae0512a47..acc5f678e2 100644
--- a/src/rabbit_auth_mechanism_amqplain.erl
+++ b/src/rabbit_auth_mechanism_amqplain.erl
@@ -41,13 +41,21 @@ should_offer(_Sock) ->
init(_Sock) ->
[].
+-define(IS_STRING_TYPE(Type), Type =:= longstr orelse Type =:= shortstr).
+
handle_response(Response, _State) ->
LoginTable = rabbit_binary_parser:parse_table(Response),
case {lists:keysearch(<<"LOGIN">>, 1, LoginTable),
lists:keysearch(<<"PASSWORD">>, 1, LoginTable)} of
- {{value, {_, longstr, User}},
- {value, {_, longstr, Pass}}} ->
+ {{value, {_, UserType, User}},
+ {value, {_, PassType, Pass}}} when ?IS_STRING_TYPE(UserType);
+ ?IS_STRING_TYPE(PassType) ->
rabbit_access_control:check_user_pass_login(User, Pass);
+ {{value, {_, _UserType, _User}},
+ {value, {_, _PassType, _Pass}}} ->
+ {protocol_error,
+ "AMQPLAIN auth info ~w uses unsupported type for LOGIN or PASSWORD field",
+ [LoginTable]};
_ ->
{protocol_error,
"AMQPLAIN auth info ~w is missing LOGIN or PASSWORD field",