summaryrefslogtreecommitdiff
path: root/src/cyrsasl.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2016-12-11 15:03:37 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2016-12-11 15:03:37 +0300
commit5cc8e807df6994fa6b0e860bbcfe0af8fa7fe19f (patch)
treef10816cf358fce8744f87e722667683a623e22ec /src/cyrsasl.erl
parentFix reload_config (diff)
Initial version of new XMPP stream behaviour (for review)
Diffstat (limited to 'src/cyrsasl.erl')
-rw-r--r--src/cyrsasl.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cyrsasl.erl b/src/cyrsasl.erl
index 4b0f5a26..e2319647 100644
--- a/src/cyrsasl.erl
+++ b/src/cyrsasl.erl
@@ -31,7 +31,7 @@
-export([start/0, register_mechanism/3, listmech/1,
server_new/7, server_start/3, server_step/2,
- opt_type/1]).
+ get_mech/1, opt_type/1]).
-include("ejabberd.hrl").
-include("logger.hrl").
@@ -53,6 +53,7 @@
-type(password_type() :: plain | digest | scram).
-type(props() :: [{username, binary()} |
{authzid, binary()} |
+ {mechanism, binary()} |
{auth_module, atom()}]).
-type(sasl_mechanism() :: #sasl_mechanism{}).
@@ -65,9 +66,11 @@
get_password,
check_password,
check_password_digest,
+ mech_name = <<"">>,
mech_mod,
mech_state
}).
+-type sasl_state() :: #sasl_state{}.
-callback mech_new(binary(), fun(), fun(), fun()) -> any().
-callback mech_step(any(), binary()) -> {ok, props()} |
@@ -150,6 +153,7 @@ server_start(State, Mech, ClientIn) ->
State#sasl_state.check_password,
State#sasl_state.check_password_digest),
server_step(State#sasl_state{mech_mod = Module,
+ mech_name = Mech,
mech_state = MechState},
ClientIn);
_ -> {error, 'no-mechanism'}
@@ -181,6 +185,10 @@ server_step(State, ClientIn) ->
{error, Error}
end.
+-spec get_mech(sasl_state()) -> binary().
+get_mech(#sasl_state{mech_name = Mech}) ->
+ Mech.
+
%% Remove the anonymous mechanism from the list if not enabled for the given
%% host
%%