diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-12-09 22:39:43 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-12-09 22:39:43 +0300 |
commit | 614bd9dd723bc7f4d854adfc2ab8b475027297a9 (patch) | |
tree | 2d368b88fc7e1bd3b97d5d7304ed9f8b199fe1c0 /src/xmpp_stream_out.erl | |
parent | Log warning on empty wildcard paths (diff) |
Better process subtag decoding errors
Diffstat (limited to 'src/xmpp_stream_out.erl')
-rw-r--r-- | src/xmpp_stream_out.erl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/xmpp_stream_out.erl b/src/xmpp_stream_out.erl index 33598497..8f4fa5c8 100644 --- a/src/xmpp_stream_out.erl +++ b/src/xmpp_stream_out.erl @@ -522,7 +522,7 @@ process_features(StreamFeatures, false -> TLSRequired = is_starttls_required(State1), TLSAvailable = is_starttls_available(State1), - case xmpp:get_subtag(StreamFeatures, #starttls{}) of + try xmpp:try_subtag(StreamFeatures, #starttls{}) of false when TLSRequired and not Encrypted -> Txt = <<"Use of STARTTLS required">>, send_pkt(State1, xmpp:serr_policy_violation(Txt, Lang)); @@ -543,14 +543,20 @@ process_features(StreamFeatures, case is_disconnected(State2) of true -> State2; false -> - case xmpp:get_subtag(StreamFeatures, #sasl_mechanisms{}) of + try xmpp:try_subtag(StreamFeatures, #sasl_mechanisms{}) of #sasl_mechanisms{list = Mechs} -> process_sasl_mechanisms(Mechs, State2); false -> process_sasl_failure( <<"Peer provided no SASL mechanisms">>, State2) + catch _:{xmpp_codec, Why} -> + Txt = xmpp:io_format_error(Why), + process_sasl_failure(Txt, State1) end end + catch _:{xmpp_codec, Why} -> + Txt = xmpp:io_format_error(Why), + process_sasl_failure(Txt, State1) end end. |