25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

* src/ejabberd_service.erl: Proper handling of bad XML

* src/mod_muc/mod_muc_room.erl: Append number of participants in
disco replies if requester allowed to see participant list

* src/mod_muc/mod_muc.erl (iq_disco_items): Pass requester JID to
room process

* src/mod_irc/mod_irc_connection.erl: Exit on receiving of
presence or message error

* src/mod_irc/mod_irc_connection.erl (handle_info): Return
"feature not implemented" on iq request with unknown namespace

SVN Revision: 111
This commit is contained in:
Alexey Shchepin 2003-05-29 19:07:41 +00:00
parent d719a93fa1
commit f05efc0814
6 changed files with 86 additions and 15 deletions

View File

@ -1,3 +1,19 @@
2003-05-29 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_service.erl: Proper handling of bad XML
* src/mod_muc/mod_muc_room.erl: Append number of participants in
disco replies if requester allowed to see participant list
* src/mod_muc/mod_muc.erl (iq_disco_items): Pass requester JID to
room process
* src/mod_irc/mod_irc_connection.erl: Exit on receiving of
presence or message error
* src/mod_irc/mod_irc_connection.erl (handle_info): Return
"feature not implemented" on iq request with unknown namespace
2003-05-18 Alexey Shchepin <alexey@sevcom.net> 2003-05-18 Alexey Shchepin <alexey@sevcom.net>
* src/mod_muc/mod_muc.erl: Now body of message from admin to MUC * src/mod_muc/mod_muc.erl: Now body of message from admin to MUC

10
TODO
View File

@ -8,15 +8,17 @@ admin interface
backup management backup management
S2S: S2S:
* timeouts
* rewrite S2S key validation * rewrite S2S key validation
more correctly work with SRV DNS records (priority, weight, etc...) more correctly work with SRV DNS records (priority, weight, etc...)
SSL TLS
JEP-62,63 (?) Privacy rules
make roster set to work in one transaction make roster set to work in one transaction
add traffic shapers to c2s connection before authentification add traffic shapers to c2s connection before authentification
add traffic shapers to s2s connections add traffic shapers to s2s connections
more traffic shapers more traffic shapers
SNMP SNMP
PubSub
MUC: remove empty non-persistent conferences after timeout
MUC: remove a lot of debugging output
IRC: disconnect on receiving of error message or presence

View File

@ -61,6 +61,11 @@
"</stream:stream>" "</stream:stream>"
). ).
-define(INVALID_XML_ERR,
xml:element_to_string(?SERR_XML_NOT_WELL_FORMED)).
-define(INVALID_NS_ERR,
xml:element_to_string(?SERR_INVALID_NAMESPACE)).
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
%%% API %%% API
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
@ -123,6 +128,13 @@ wait_for_stream({xmlstreamstart, Name, Attrs}, StateData) ->
{stop, normal, StateData} {stop, normal, StateData}
end; end;
wait_for_stream({xmlstreamerror, _}, StateData) ->
Header = io_lib:format(?STREAM_HEADER,
["none", ?MYNAME]),
send_text(StateData#state.socket,
Header ++ ?INVALID_XML_ERR ++ ?STREAM_TRAILER),
{stop, normal, StateData};
wait_for_stream(closed, StateData) -> wait_for_stream(closed, StateData) ->
{stop, normal, StateData}. {stop, normal, StateData}.
@ -148,6 +160,10 @@ wait_for_handshake({xmlstreamelement, El}, StateData) ->
wait_for_handshake({xmlstreamend, Name}, StateData) -> wait_for_handshake({xmlstreamend, Name}, StateData) ->
{stop, normal, StateData}; {stop, normal, StateData};
wait_for_handshake({xmlstreamerror, _}, StateData) ->
send_text(StateData#state.socket, ?INVALID_XML_ERR ++ ?STREAM_TRAILER),
{stop, normal, StateData};
wait_for_handshake(closed, StateData) -> wait_for_handshake(closed, StateData) ->
{stop, normal, StateData}. {stop, normal, StateData}.
@ -184,6 +200,10 @@ stream_established({xmlstreamend, Name}, StateData) ->
% TODO % TODO
{stop, normal, StateData}; {stop, normal, StateData};
stream_established({xmlstreamerror, _}, StateData) ->
send_text(StateData#state.socket, ?INVALID_XML_ERR ++ ?STREAM_TRAILER),
{stop, normal, StateData};
stream_established(closed, StateData) -> stream_established(closed, StateData) ->
% TODO % TODO
{stop, normal, StateData}. {stop, normal, StateData}.

View File

@ -184,6 +184,7 @@ handle_info({route_chan, Channel, Resource,
"subscribed" -> StateData; "subscribed" -> StateData;
"unsubscribe" -> StateData; "unsubscribe" -> StateData;
"unsubscribed" -> StateData; "unsubscribed" -> StateData;
"error" -> stop;
_ -> _ ->
Nick = case Resource of Nick = case Resource of
"" -> "" ->
@ -204,11 +205,16 @@ handle_info({route_chan, Channel, Resource,
S1#state.channels)} S1#state.channels)}
end end
end, end,
case length(dict:fetch_keys(NewStateData#state.channels)) of if
0 -> NewStateData == stop ->
{stop, normal, NewStateData}; {stop, normal, StateData};
_ -> true ->
{next_state, StateName, NewStateData} case length(dict:fetch_keys(NewStateData#state.channels)) of
0 ->
{stop, normal, NewStateData};
_ ->
{next_state, StateName, NewStateData}
end
end; end;
handle_info({route_chan, Channel, Resource, handle_info({route_chan, Channel, Resource,
@ -265,10 +271,17 @@ handle_info({route_chan, Channel, Resource,
[Resource, S]) [Resource, S])
end, Strings)), end, Strings)),
?SEND(Res); ?SEND(Res);
"error" ->
stop;
_ -> _ ->
StateData StateData
end, end,
{next_state, StateName, NewStateData}; if
NewStateData == stop ->
{stop, normal, StateData};
true ->
{next_state, StateName, NewStateData}
end;
handle_info({route_chan, Channel, Resource, handle_info({route_chan, Channel, Resource,
@ -285,7 +298,7 @@ handle_info({route_chan, Channel, Resource,
ID, XMLNS, Type, SubEl); ID, XMLNS, Type, SubEl);
_ -> _ ->
Err = jlib:make_error_reply( Err = jlib:make_error_reply(
El, ?ERR_SERVICE_UNAVAILABLE), El, ?ERR_FEATURE_NOT_IMPLEMENTED),
ejabberd_router:route(To, From, Err) ejabberd_router:route(To, From, Err)
end, end,
{next_state, StateName, StateData}; {next_state, StateName, StateData};
@ -315,10 +328,17 @@ handle_info({route_nick, Nick,
[Nick, S]) [Nick, S])
end, Strings)), end, Strings)),
?SEND(Res); ?SEND(Res);
"error" ->
stop;
_ -> _ ->
StateData StateData
end, end,
{next_state, StateName, NewStateData}; if
NewStateData == stop ->
{stop, normal, StateData};
true ->
{next_state, StateName, NewStateData}
end;
handle_info({route_nick, Nick, Packet}, StateName, StateData) -> handle_info({route_nick, Nick, Packet}, StateName, StateData) ->
{next_state, StateName, StateData}; {next_state, StateName, StateData};

View File

@ -276,7 +276,7 @@ process_iq_disco_items(Host, From, To, ID, SubEl) ->
iq_disco_items(Host, From) -> iq_disco_items(Host, From) ->
lists:zf(fun(#muc_online_room{name = Name, pid = Pid}) -> lists:zf(fun(#muc_online_room{name = Name, pid = Pid}) ->
case catch gen_fsm:sync_send_all_state_event( case catch gen_fsm:sync_send_all_state_event(
Pid, get_disco_item, 100) of Pid, {get_disco_item, From}, 100) of
{item, Desc} -> {item, Desc} ->
{true, {true,
{xmlelement, "item", {xmlelement, "item",

View File

@ -552,10 +552,23 @@ handle_event(Event, StateName, StateData) ->
%% {stop, Reason, NewStateData} | %% {stop, Reason, NewStateData} |
%% {stop, Reason, Reply, NewStateData} %% {stop, Reason, Reply, NewStateData}
%%---------------------------------------------------------------------- %%----------------------------------------------------------------------
handle_sync_event(get_disco_item, From, StateName, StateData) -> handle_sync_event({get_disco_item, JID}, From, StateName, StateData) ->
FAffiliation = get_affiliation(JID, StateData),
FRole = get_role(JID, StateData),
Tail =
case ((StateData#state.config)#config.public_list == true) orelse
(FRole /= none) orelse
(FAffiliation == admin) orelse
(FAffiliation == owner) of
true ->
Len = length(?DICT:to_list(StateData#state.users)),
" (" ++ integer_to_list(Len) ++ ")";
_ ->
""
end,
Reply = case (StateData#state.config)#config.public of Reply = case (StateData#state.config)#config.public of
true -> true ->
{item, get_title(StateData)}; {item, get_title(StateData) ++ Tail};
_ -> _ ->
false false
end, end,