diff --git a/ChangeLog b/ChangeLog index 884c6da6a..cb262e43e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-07-28 Mickael Remond + + * src/ejabberd_c2s.erl: Bugfix: added a missing catch and fixed the + error code used on unknown namespace. + * src/ejabberd_s2s_out.erl: Improved s2s connection negociation + (dialback namespace usage) when using tls. + * src/ejabberd_sm.erl: Fixed the error code used on unknown namespace. + * src/mod_register.erl: ejabberd now sends iq result and stream end on + user remove. + 2006-07-16 Mickael Remond * src/acl.erl: The server does not crash anymore on wrong acl rule. Add diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index 8683f62cb..84c855c30 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -1109,6 +1109,7 @@ handle_info({route, From, To, Packet}, StateName, StateData) -> end, if Pass == exit -> + catch send_text(StateData, ?STREAM_TRAILER), {stop, normal, StateData}; Pass -> Attrs2 = jlib:replace_from_to_attrs(jlib:jid_to_string(From), @@ -1768,7 +1769,7 @@ process_unauthenticated_stanza(StateData, El) -> % The only reasonable IQ's here are auth and register IQ's % They contain secrets, so don't include subelements to response ResIQ = IQ#iq{type = error, - sub_el = [?ERR_FEATURE_NOT_IMPLEMENTED]}, + sub_el = [?ERR_SERVICE_UNAVAILABLE]}, Res1 = jlib:replace_from_to( jlib:make_jid("", StateData#state.server, ""), jlib:make_jid("", "", ""), diff --git a/src/ejabberd_s2s_out.erl b/src/ejabberd_s2s_out.erl index 12beac468..358abf5a3 100644 --- a/src/ejabberd_s2s_out.erl +++ b/src/ejabberd_s2s_out.erl @@ -8,7 +8,6 @@ -module(ejabberd_s2s_out). -author('alexey@sevcom.net'). --vsn('$Revision$ '). -behaviour(gen_fsm). @@ -46,6 +45,7 @@ tls_enabled = false, tls_options = [], authenticated = false, + db_enabled = true, try_auth = true, myname, server, queue, new = false, verify = false, @@ -224,12 +224,7 @@ wait_for_stream({xmlstreamstart, Name, Attrs}, StateData) -> StateData#state.use_v10 -> {next_state, wait_for_features, StateData}; {"jabber:server", "", true} when StateData#state.use_v10 -> - ?INFO_MSG("restarted: ~p", [{StateData#state.myname, - StateData#state.server}]), - % TODO: clear message queue - ejabberd_receiver:close(StateData#state.receiver), - {next_state, reopen_socket, StateData#state{socket = undefined, - use_v10 = false}}; + {next_state, wait_for_features, StateData#state{db_enabled = false}}; _ -> send_text(StateData, ?INVALID_NAMESPACE_ERR), {stop, normal, StateData} @@ -372,8 +367,15 @@ wait_for_features({xmlstreamelement, El}, StateData) -> {next_state, reopen_socket, StateData#state{socket = undefined, use_v10 = false}}; + StateData#state.db_enabled -> + send_db_request(StateData); true -> - send_db_request(StateData) + ?INFO_MSG("restarted: ~p", [{StateData#state.myname, + StateData#state.server}]), + % TODO: clear message queue + ejabberd_receiver:close(StateData#state.receiver), + {next_state, reopen_socket, StateData#state{socket = undefined, + use_v10 = false}} end; _ -> send_text(StateData, diff --git a/src/ejabberd_sm.erl b/src/ejabberd_sm.erl index f140951da..7f4d6b87a 100644 --- a/src/ejabberd_sm.erl +++ b/src/ejabberd_sm.erl @@ -555,7 +555,7 @@ process_iq(From, To, Packet) -> From, To, IQ); [] -> Err = jlib:make_error_reply( - Packet, ?ERR_FEATURE_NOT_IMPLEMENTED), + Packet, ?ERR_SERVICE_UNAVAILABLE), ejabberd_router:route(To, From, Err) end; reply -> diff --git a/src/mod_register.erl b/src/mod_register.erl index 4d1da09b1..a5621f0f3 100644 --- a/src/mod_register.erl +++ b/src/mod_register.erl @@ -8,7 +8,6 @@ -module(mod_register). -author('alexey@sevcom.net'). --vsn('$Revision$ '). -behaviour(gen_mod). @@ -59,7 +58,7 @@ unauthenticated_iq_register(Acc, _Server, _IQ) -> Acc. process_iq(From, To, - #iq{type = Type, lang = Lang, sub_el = SubEl} = IQ) -> + #iq{type = Type, lang = Lang, sub_el = SubEl, id = ID} = IQ) -> case Type of set -> UTag = xml:get_subtag(SubEl, "username"), @@ -104,9 +103,18 @@ process_iq(From, To, end; (UTag == false) and (RTag /= false) -> case From of - #jid{user = User, lserver = Server} -> + #jid{user = User, + lserver = Server, + resource = Resource} -> + ResIQ = #iq{type = result, xmlns = ?NS_REGISTER, + id = ID, + sub_el = [SubEl]}, + ejabberd_router:route( + jlib:make_jid(User, Server, Resource), + jlib:make_jid(User, Server, Resource), + jlib:iq_to_xml(ResIQ)), ejabberd_auth:remove_user(User, Server), - IQ#iq{type = result, sub_el = [SubEl]}; + ignore; _ -> IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]}