summaryrefslogtreecommitdiff
path: root/src/rabbit_auth_mechanism_plain.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rabbit_auth_mechanism_plain.erl')
-rw-r--r--src/rabbit_auth_mechanism_plain.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rabbit_auth_mechanism_plain.erl b/src/rabbit_auth_mechanism_plain.erl
index 1ca07018..2448acb6 100644
--- a/src/rabbit_auth_mechanism_plain.erl
+++ b/src/rabbit_auth_mechanism_plain.erl
@@ -19,7 +19,7 @@
-behaviour(rabbit_auth_mechanism).
--export([description/0, init/1, handle_response/2]).
+-export([description/0, should_offer/1, init/1, handle_response/2]).
-include("rabbit_auth_mechanism_spec.hrl").
@@ -41,6 +41,9 @@ description() ->
[{name, <<"PLAIN">>},
{description, <<"SASL PLAIN authentication mechanism">>}].
+should_offer(_Sock) ->
+ true.
+
init(_Sock) ->
[].
@@ -62,15 +65,12 @@ extract_user_pass(Response) ->
end.
extract_elem(<<0:8, Rest/binary>>) ->
- Count = next_null_pos(Rest),
+ Count = next_null_pos(Rest, 0),
<<Elem:Count/binary, Rest1/binary>> = Rest,
{ok, Elem, Rest1};
extract_elem(_) ->
error.
-next_null_pos(Bin) ->
- next_null_pos(Bin, 0).
-
next_null_pos(<<>>, Count) -> Count;
next_null_pos(<<0:8, _Rest/binary>>, Count) -> Count;
next_null_pos(<<_:8, Rest/binary>>, Count) -> next_null_pos(Rest, Count + 1).