diff --git a/src/cyrsasl_gssapi.erl b/src/cyrsasl_gssapi.erl index 5fdf071a5..11d995587 100644 --- a/src/cyrsasl_gssapi.erl +++ b/src/cyrsasl_gssapi.erl @@ -52,7 +52,6 @@ -behaviour(cyrsasl). -define(SERVER, ?MODULE). --define(MSG, ?DEBUG). -define(SERVICE, "xmpp"). -record(state, {sasl, @@ -91,35 +90,35 @@ stop() -> mech_new(#sasl_params{host=Host, realm=Realm, socket=Socket}) -> case ejabberd_socket:gethostname(Socket) of {ok, FQDN} -> - ?MSG("mech_new ~p ~p ~p~n", [Host, Realm, FQDN]), + ?DEBUG("mech_new ~p ~p ~p~n", [Host, Realm, FQDN]), case esasl:server_start(?SERVER, "GSSAPI", ?SERVICE, FQDN) of {ok, Sasl} -> {ok, #state{sasl=Sasl,host=Host,realm=Realm}}; {error, {gsasl_error, Error}} -> {ok, Str} = esasl:str_error(?SERVER, Error), - ?MSG("esasl error: ~p", [Str]), + ?DEBUG("esasl error: ~p", [Str]), {ok, #state{needsmore=error,error="internal-server-error"}}; {error, Error} -> - ?MSG("esasl error: ~p", [Error]), + ?DEBUG("esasl error: ~p", [Error]), {ok, #state{needsmore=error,error="internal-server-error"}} end; {error, Error} -> - ?MSG("gethostname error: ~p", [Error]), + ?DEBUG("gethostname error: ~p", [Error]), {ok, #state{needsmore=error,error="internal-server-error"}} end. mech_step(State, ClientIn) when is_list(ClientIn) -> catch do_step(State, ClientIn). -do_step(#state{needsmore=error,error=Error}=State, _) -> +do_step(#state{needsmore=error,error=Error}=_State, _) -> {error, Error}; do_step(#state{needsmore=false}=State, _) -> check_user(State); do_step(#state{needsmore=true,sasl=Sasl,step=Step}=State, ClientIn) -> - ?MSG("mech_step~n", []), + ?DEBUG("mech_step~n", []), case esasl:step(Sasl, list_to_binary(ClientIn)) of {ok, RspAuth} -> - ?MSG("ok~n", []), + ?DEBUG("ok~n", []), {ok, Display_name} = esasl:property_get(Sasl, gssapi_display_name), {ok, Authzid} = esasl:property_get(Sasl, authzid), {Authid, [$@ | Auth_realm]} = @@ -129,7 +128,7 @@ do_step(#state{needsmore=true,sasl=Sasl,step=Step}=State, ClientIn) -> authrealm=Auth_realm}, handle_step_ok(State1, binary_to_list(RspAuth)); {needsmore, RspAuth} -> - ?MSG("needsmore~n", []), + ?DEBUG("needsmore~n", []), if (Step > 0) and (ClientIn =:= []) and (RspAuth =:= <<>>) -> {error, "not-authorized"}; true -> @@ -143,13 +142,13 @@ do_step(#state{needsmore=true,sasl=Sasl,step=Step}=State, ClientIn) -> handle_step_ok(State, []) -> check_user(State); handle_step_ok(#state{step=Step}=State, RspAuth) -> - ?MSG("continue~n", []), + ?DEBUG("continue~n", []), {continue, RspAuth, State#state{needsmore=false,step=Step+1}}. check_user(#state{authid=Authid,authzid=Authzid, authrealm=Auth_realm,host=Host,realm=Realm}) -> if Realm =/= Auth_realm -> - ?MSG("bad realm ~p (expected ~p)~n",[Auth_realm, Realm]), + ?DEBUG("bad realm ~p (expected ~p)~n",[Auth_realm, Realm]), throw({error, "not-authorized"}); true -> ok @@ -157,11 +156,11 @@ check_user(#state{authid=Authid,authzid=Authzid, case ejabberd_auth:is_user_exists(Authid, Host) of false -> - ?MSG("bad user ~p~n",[Authid]), + ?DEBUG("bad user ~p~n",[Authid]), throw({error, "not-authorized"}); true -> ok end, - ?MSG("GSSAPI authenticated ~p ~p~n", [Authid, Authzid]), + ?DEBUG("GSSAPI authenticated ~p ~p~n", [Authid, Authzid]), {ok, [{username, Authid}, {authzid, Authzid}]}. diff --git a/src/cyrsasl_plain.erl b/src/cyrsasl_plain.erl index 690e99281..5759f7202 100644 --- a/src/cyrsasl_plain.erl +++ b/src/cyrsasl_plain.erl @@ -50,7 +50,7 @@ start(_Opts) -> stop() -> ok. -mech_new(_Host, _GetPassword, CheckPassword, _CheckPasswordDigest) -> +mech_new(#sasl_params{check_password = CheckPassword}) -> {ok, #state{check_password = CheckPassword}}. %% @spec (State, ClientIn) -> Ok | Error diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index 01d3c92c1..065a58ebb 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -383,7 +383,7 @@ wait_for_stream({xmlstreamstart, #xmlel{ns = NS} = Opening}, StateData) -> exmpp_stream:features( TLSFeature ++ CompressFeature ++ - SASL_Mechs ++ + Mechs ++ Other_Feats)), fsm_next_state(wait_for_feature_request, StateData#state{ diff --git a/src/ejabberd_socket.erl b/src/ejabberd_socket.erl index 6de915b35..2c7dd783c 100644 --- a/src/ejabberd_socket.erl +++ b/src/ejabberd_socket.erl @@ -240,10 +240,10 @@ gethostname(#socket_state{socket = Socket} = State) -> ?DEBUG("gethostname result ~p~n", [HostEnt#hostent.h_name]), {ok, HostEnt#hostent.h_name}; - {error, Reason} = E -> + {error, _Reason} = E -> E end; - {error, Reason} = E -> + {error, _Reason} = E -> E end.