mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-12 17:01:52 +01:00
* src/ejabberd_listener.erl: Added handling of accept errors,
added timeout value to ssl:accept * src/mod_vcard.erl: Added checks for all empty input fields * src/mod_offline.erl: More strong checks for stored packets SVN Revision: 163
This commit is contained in:
parent
20dada9aca
commit
188be0dc62
@ -1,5 +1,12 @@
|
||||
2003-10-28 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/ejabberd_listener.erl: Added handling of accept errors,
|
||||
added timeout value to ssl:accept
|
||||
|
||||
* src/mod_vcard.erl: Added checks for all empty input fields
|
||||
|
||||
* src/mod_offline.erl: More strong checks for stored packets
|
||||
|
||||
* src/ejabberd_sm.erl: Bugfix
|
||||
|
||||
2003-10-27 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
@ -67,16 +67,11 @@ accept(ListenSocket, Module, Opts) ->
|
||||
ok
|
||||
end,
|
||||
{ok, Pid} = Module:start({gen_tcp, Socket}, Opts),
|
||||
%{ok, Pid} =
|
||||
% supervisor:start_child(
|
||||
% ejabberd_tmp_sup,
|
||||
% {{Module, Socket},
|
||||
% {Module, start_link, [{gen_tcp, Socket}, Opts]},
|
||||
% transient,
|
||||
% brutal_kill,
|
||||
% worker,
|
||||
% [Module]}),
|
||||
gen_tcp:controlling_process(Socket, Pid),
|
||||
accept(ListenSocket, Module, Opts);
|
||||
{error, Reason} ->
|
||||
?INFO_MSG("(~w) Failed TCP accept: ~w",
|
||||
[ListenSocket, Reason]),
|
||||
accept(ListenSocket, Module, Opts)
|
||||
end.
|
||||
|
||||
@ -90,7 +85,7 @@ init_ssl(Port, Module, Opts, SSLOpts) ->
|
||||
accept_ssl(ListenSocket, Module, Opts).
|
||||
|
||||
accept_ssl(ListenSocket, Module, Opts) ->
|
||||
case ssl:accept(ListenSocket) of
|
||||
case ssl:accept(ListenSocket, 200) of
|
||||
{ok, Socket} ->
|
||||
case {ssl:sockname(Socket), ssl:peername(Socket)} of
|
||||
{{ok, Addr}, {ok, PAddr}} ->
|
||||
@ -99,7 +94,13 @@ accept_ssl(ListenSocket, Module, Opts) ->
|
||||
_ ->
|
||||
ok
|
||||
end,
|
||||
apply(Module, start_link, [{ssl, Socket}, Opts]),
|
||||
Module:start_link({ssl, Socket}, Opts),
|
||||
accept_ssl(ListenSocket, Module, Opts);
|
||||
{error, timeout} ->
|
||||
accept_ssl(ListenSocket, Module, Opts);
|
||||
{error, Reason} ->
|
||||
?INFO_MSG("(~w) Failed SSL handshake: ~w",
|
||||
[ListenSocket, Reason]),
|
||||
accept_ssl(ListenSocket, Module, Opts)
|
||||
end.
|
||||
|
||||
|
@ -65,6 +65,8 @@ stop() ->
|
||||
|
||||
store_packet(From, To, Packet) ->
|
||||
true = is_process_alive(whereis(?PROCNAME)),
|
||||
Type = xml:get_tag_attr_s("type", Packet),
|
||||
true = Type /= "error" andalso Type /= "groupchat",
|
||||
case check_event(From, To, Packet) of
|
||||
true ->
|
||||
#jid{luser = LUser} = To,
|
||||
|
@ -22,6 +22,8 @@
|
||||
-include("jlib.hrl").
|
||||
|
||||
|
||||
%-define(JUD_ALLOW_RETURN_ALL, true)
|
||||
|
||||
-record(vcard_search, {user, luser,
|
||||
fn, lfn,
|
||||
family, lfamily,
|
||||
@ -386,6 +388,7 @@ record_to_item(R) ->
|
||||
]
|
||||
}.
|
||||
|
||||
-ifdef(JUD_ALLOW_RETURN_ALL).
|
||||
|
||||
search(Data) ->
|
||||
MatchSpec = make_matchspec(Data),
|
||||
@ -397,6 +400,27 @@ search(Data) ->
|
||||
Rs
|
||||
end.
|
||||
|
||||
-else.
|
||||
|
||||
search(Data) ->
|
||||
MatchSpec = make_matchspec(Data),
|
||||
if
|
||||
MatchSpec == #vcard_search{_ = '_'} ->
|
||||
[];
|
||||
true ->
|
||||
case catch mnesia:dirty_select(vcard_search,
|
||||
[{MatchSpec, [], ['$_']}]) of
|
||||
{'EXIT', Reason} ->
|
||||
?ERROR_MSG("~p", [Reason]),
|
||||
[];
|
||||
Rs ->
|
||||
Rs
|
||||
end
|
||||
end.
|
||||
|
||||
-endif.
|
||||
|
||||
|
||||
% TODO: remove
|
||||
% F = fun() ->
|
||||
% mnesia:select(vcard_search, [{MatchSpec, [], ['$_']}])
|
||||
|
Loading…
Reference in New Issue
Block a user