mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Fix bug when clients connect using legacy ssl
(ejabberd_receiver:process_data/2 was called before initializing the xmlstream). SVN Revision: 1933
This commit is contained in:
parent
3336d66fc4
commit
f0d55c9a3f
@ -3,6 +3,10 @@
|
||||
* src/ejabberd_auth_anonymous.erl: Host argument for ejabberd_hooks's
|
||||
functions must be in binary() format.
|
||||
|
||||
* src/ejabberd_receiver.erl: Fix bug when clients connect using legacy
|
||||
ssl (ejabberd_receiver:process_data/2 was called before initializing
|
||||
the xmlstream).
|
||||
|
||||
2009-02-28 Badlop <badlop@process-one.net>
|
||||
|
||||
* src/mod_pubsub/node_default.erl: Fix that non-subscriber could
|
||||
|
@ -132,9 +132,8 @@ init([Socket, SockMod, Shaper, MaxStanzaSize]) ->
|
||||
%% {stop, Reason, State}
|
||||
%% Description: Handling call messages
|
||||
%%--------------------------------------------------------------------
|
||||
handle_call({starttls, TLSSocket}, _From,
|
||||
#state{xml_stream_state = XMLStreamState} = State) ->
|
||||
NewXMLStreamState = do_reset_stream(XMLStreamState),
|
||||
handle_call({starttls, TLSSocket}, _From, State) ->
|
||||
NewXMLStreamState = do_reset_stream(State),
|
||||
NewState = State#state{socket = TLSSocket,
|
||||
sock_mod = tls,
|
||||
xml_stream_state = NewXMLStreamState},
|
||||
@ -165,17 +164,8 @@ handle_call(reset_stream, _From,
|
||||
{reply, Reply, State#state{xml_stream_state = NewXMLStreamState},
|
||||
?HIBERNATE_TIMEOUT};
|
||||
handle_call({become_controller, C2SPid}, _From, State) ->
|
||||
Parser = exmpp_xml:start_parser([
|
||||
{names_as_atom, true},
|
||||
{check_nss, xmpp},
|
||||
{check_elems, xmpp},
|
||||
{check_attrs, xmpp},
|
||||
{max_size, State#state.max_stanza_size}
|
||||
]),
|
||||
XMLStreamState = exmpp_xmlstream:start(
|
||||
{gen_fsm, C2SPid}, Parser,
|
||||
[{xmlstreamstart, new}]
|
||||
),
|
||||
close_stream(State#state.xml_stream_state),
|
||||
XMLStreamState = new_xmlstream(C2SPid, State#state.max_stanza_size),
|
||||
NewState = State#state{c2s_pid = C2SPid,
|
||||
xml_stream_state = XMLStreamState},
|
||||
activate_socket(NewState),
|
||||
@ -327,8 +317,22 @@ close_stream(XMLStreamState) ->
|
||||
exmpp_xmlstream:stop(XMLStreamState).
|
||||
|
||||
|
||||
do_reset_stream(undefined) ->
|
||||
undefined;
|
||||
do_reset_stream(#state{xml_stream_state = undefined, c2s_pid = C2SPid, max_stanza_size = MaxStanzaSize}) ->
|
||||
new_xmlstream(C2SPid, MaxStanzaSize);
|
||||
|
||||
do_reset_stream(XMLStreamState) ->
|
||||
do_reset_stream(#state{xml_stream_state = XMLStreamState}) ->
|
||||
exmpp_xmlstream:reset(XMLStreamState).
|
||||
|
||||
|
||||
new_xmlstream(C2SPid, MaxStanzaSize) ->
|
||||
Parser = exmpp_xml:start_parser([
|
||||
{names_as_atom, true},
|
||||
{check_nss, xmpp},
|
||||
{check_elems, xmpp},
|
||||
{check_attrs, xmpp},
|
||||
{max_size, MaxStanzaSize}
|
||||
]),
|
||||
exmpp_xmlstream:start(
|
||||
{gen_fsm, C2SPid}, Parser,
|
||||
[{xmlstreamstart, new}]
|
||||
).
|
||||
|
Loading…
Reference in New Issue
Block a user