25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

Only start GSSAPI support when configured, and when esasl is found

This commit is contained in:
Badlop 2010-07-31 01:08:11 +02:00
parent 3181685158
commit 02f19c0c1d

View File

@ -35,6 +35,7 @@
server_step/2]). server_step/2]).
-include("cyrsasl.hrl"). -include("cyrsasl.hrl").
-include("ejabberd.hrl").
%% @type saslmechanism() = {sasl_mechanism, Mechanism, Module, Require_Plain} %% @type saslmechanism() = {sasl_mechanism, Mechanism, Module, Require_Plain}
%% Mechanism = string() %% Mechanism = string()
@ -73,12 +74,28 @@ start() ->
ets:new(sasl_mechanism, [named_table, ets:new(sasl_mechanism, [named_table,
public, public,
{keypos, #sasl_mechanism.mechanism}]), {keypos, #sasl_mechanism.mechanism}]),
cyrsasl_gssapi:start([]),
cyrsasl_plain:start([]), cyrsasl_plain:start([]),
cyrsasl_digest:start([]), cyrsasl_digest:start([]),
cyrsasl_anonymous:start([]), cyrsasl_anonymous:start([]),
maybe_try_start_gssapi(),
ok. ok.
maybe_try_start_gssapi() ->
case os:getenv("KRB5_KTNAME") of
false ->
ok;
_String ->
try_start_gssapi()
end.
try_start_gssapi() ->
case code:load_file(esasl) of
{module, _Module} ->
cyrsasl_gssapi:start([]);
{error, What} ->
?ERROR_MSG("Support for GSSAPI not started because esasl.beam was not found: ~p", [What])
end.
%% @spec (Mechanism, Module, Require_Plain) -> true %% @spec (Mechanism, Module, Require_Plain) -> true
%% Mechanism = string() %% Mechanism = string()
%% Module = atom() %% Module = atom()