summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2019-03-14 14:28:00 +0300
committerMichael Klishin <michael@clojurewerkz.org>2019-03-14 14:28:00 +0300
commitf18fdcecf9322c446e0082e774decd26100bc956 (patch)
tree86fe02cdb69bb6a2961d88549414ac32cf91e1d2 /src
parentdca81782e82189c992afecb99035d3797756147c (diff)
downloadrabbitmq-server-git-f18fdcecf9322c446e0082e774decd26100bc956.tar.gz
Simplify further with a macro, suggested by @dumbbell
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_auth_mechanism_amqplain.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rabbit_auth_mechanism_amqplain.erl b/src/rabbit_auth_mechanism_amqplain.erl
index a2b610eaa3..acc5f678e2 100644
--- a/src/rabbit_auth_mechanism_amqplain.erl
+++ b/src/rabbit_auth_mechanism_amqplain.erl
@@ -41,13 +41,15 @@ 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, {_, UserType, User}},
- {value, {_, PassType, Pass}}} when UserType =:= longstr orelse UserType =:= shortstr;
- PassType =:= longstr orelse PassType =:= shortstr ->
+ {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}}} ->