mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Don't perform useless resourceprep
This commit is contained in:
parent
a098d1ec62
commit
719b4d1183
@ -24,7 +24,7 @@
|
|||||||
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.10"}}},
|
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.10"}}},
|
||||||
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.7"}}},
|
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.7"}}},
|
||||||
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.21"}}},
|
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.21"}}},
|
||||||
{xmpp, ".*", {git, "https://github.com/processone/xmpp", "f5cbd6dc0f3ec786b33a7e708979ed27dfbbb0ec"}},
|
{xmpp, ".*", {git, "https://github.com/processone/xmpp", "4aaed37a16fc21be505553aabf9f47a48b8af027"}},
|
||||||
{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.9"}}},
|
{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.9"}}},
|
||||||
{esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.10"}}},
|
{esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.10"}}},
|
||||||
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.8"}}},
|
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.8"}}},
|
||||||
|
@ -592,25 +592,17 @@ process_authenticated_packet(Pkt, #{mod := Mod} = State) ->
|
|||||||
|
|
||||||
-spec process_bind(xmpp_element(), state()) -> state().
|
-spec process_bind(xmpp_element(), state()) -> state().
|
||||||
process_bind(#iq{type = set, sub_els = [_]} = Pkt,
|
process_bind(#iq{type = set, sub_els = [_]} = Pkt,
|
||||||
#{xmlns := ?NS_CLIENT, mod := Mod, lang := Lang} = State) ->
|
#{xmlns := ?NS_CLIENT, mod := Mod} = State) ->
|
||||||
case xmpp:get_subtag(Pkt, #bind{}) of
|
case xmpp:get_subtag(Pkt, #bind{}) of
|
||||||
#bind{resource = R} ->
|
#bind{resource = R} ->
|
||||||
case jid:resourceprep(R) of
|
case Mod:bind(R, State) of
|
||||||
error ->
|
{ok, #{user := U, server := S, resource := NewR} = State1}
|
||||||
Txt = <<"Malformed resource">>,
|
when NewR /= <<"">> ->
|
||||||
Err = xmpp:err_bad_request(Txt, Lang),
|
Reply = #bind{jid = jid:make(U, S, NewR)},
|
||||||
send_error(State, Pkt, Err);
|
State2 = send_pkt(State1, xmpp:make_iq_result(Pkt, Reply)),
|
||||||
_ ->
|
process_stream_established(State2);
|
||||||
case Mod:bind(R, State) of
|
{error, #stanza_error{} = Err, State1} ->
|
||||||
{ok, #{user := U,
|
send_error(State1, Pkt, Err)
|
||||||
server := S,
|
|
||||||
resource := NewR} = State1} when NewR /= <<"">> ->
|
|
||||||
Reply = #bind{jid = jid:make(U, S, NewR)},
|
|
||||||
State2 = send_pkt(State1, xmpp:make_iq_result(Pkt, Reply)),
|
|
||||||
process_stream_established(State2);
|
|
||||||
{error, #stanza_error{} = Err, State1} ->
|
|
||||||
send_error(State1, Pkt, Err)
|
|
||||||
end
|
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
try Mod:handle_unbinded_packet(Pkt, State)
|
try Mod:handle_unbinded_packet(Pkt, State)
|
||||||
|
Loading…
Reference in New Issue
Block a user