24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-02 21:17:12 +02:00

secure calls to ets:lookup

SVN Revision: 2562
This commit is contained in:
Christophe Romain 2009-08-28 16:22:37 +00:00
parent 156c496a27
commit e29c992cbf
4 changed files with 11 additions and 11 deletions

View File

@ -3407,7 +3407,7 @@ set_xoption([_ | Opts], NewOpts) ->
is_last_item_cache_enabled({_, ServerHost, _}) ->
is_last_item_cache_enabled(ServerHost);
is_last_item_cache_enabled(Host) ->
case ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
case catch ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
[{last_item_cache, true}] -> true;
_ -> false
end.
@ -3431,7 +3431,7 @@ get_cached_item({_, ServerHost, _}, NodeId) ->
get_cached_item(Host, NodeId) ->
case is_last_item_cache_enabled(Host) of
true ->
case ets:lookup(gen_mod:get_module_proc(Host, last_items), NodeId) of
case catch ets:lookup(gen_mod:get_module_proc(Host, last_items), NodeId) of
[{NodeId, {ItemId, Payload}}] ->
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload};
_ ->
@ -3444,7 +3444,7 @@ get_cached_item(Host, NodeId) ->
%%%% plugin handling
plugins(Host) ->
case ets:lookup(gen_mod:get_module_proc(Host, config), plugins) of
case catch ets:lookup(gen_mod:get_module_proc(Host, config), plugins) of
[{plugins, []}] -> [?STDNODE];
[{plugins, PL}] -> PL;
_ -> [?STDNODE]
@ -3452,7 +3452,7 @@ plugins(Host) ->
select_type(ServerHost, Host, Node, Type)->
SelectedType = case Host of
{_User, _Server, _Resource} ->
case ets:lookup(gen_mod:get_module_proc(ServerHost, config), pep_mapping) of
case catch ets:lookup(gen_mod:get_module_proc(ServerHost, config), pep_mapping) of
[{pep_mapping, PM}] -> proplists:get_value(Node, PM, ?PEPNODE);
_ -> ?PEPNODE
end;
@ -3535,7 +3535,7 @@ tree_call({_User, Server, _Resource}, Function, Args) ->
tree_call(Server, Function, Args);
tree_call(Host, Function, Args) ->
?DEBUG("tree_call ~p ~p ~p",[Host, Function, Args]),
Module = case ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
Module = case catch ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
[{nodetree, N}] -> N;
_ -> list_to_atom(?TREE_PREFIX ++ ?STDTREE)
end,

View File

@ -598,7 +598,7 @@ get_entity_affiliations(Host, Owner) ->
SubKey = jlib:jid_tolower(Owner),
GenKey = jlib:jid_remove_resource(SubKey),
States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'}, _ = '_'}),
NodeTree = case ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
NodeTree = case catch ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
[{nodetree, N}] -> N;
_ -> nodetree_tree
end,
@ -655,7 +655,7 @@ get_entity_subscriptions(Host, Owner) ->
++ mnesia:match_object(
#pubsub_state{stateid = {SubKey, '_'}, _ = '_'})
end,
NodeTree = case ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
NodeTree = case catch ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
[{nodetree, N}] -> N;
_ -> nodetree_tree
end,
@ -759,7 +759,7 @@ get_pending_nodes(Host, Owner) ->
affiliation = owner,
_ = '_'}),
NodeIDs = [ID || #pubsub_state{stateid = {_, ID}} <- States],
NodeTree = case ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
NodeTree = case catch ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
[{nodetree, N}] -> N;
_ -> nodetree_tree
end,

View File

@ -827,7 +827,7 @@ get_pending_nodes(Host, Owner) ->
affiliation = owner,
_ = '_'}),
NodeIDs = [ID || #pubsub_state{stateid = {_, ID}} <- States],
NodeTree = case ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
NodeTree = case catch ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
[{nodetree, N}] -> N;
_ -> nodetree_tree_odbc
end,

View File

@ -172,7 +172,7 @@ get_entity_affiliations(_Host, Owner) ->
SubKey = jlib:jid_tolower(Owner),
GenKey = jlib:jid_remove_resource(SubKey),
States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'}, _ = '_'}),
NodeTree = case ets:lookup(gen_mod:get_module_proc(D, config), nodetree) of
NodeTree = case catch ets:lookup(gen_mod:get_module_proc(D, config), nodetree) of
[{nodetree, N}] -> N;
_ -> nodetree_tree
end,
@ -204,7 +204,7 @@ get_entity_subscriptions(_Host, Owner) ->
++ mnesia:match_object(
#pubsub_state{stateid = {SubKey, '_'}, _ = '_'})
end,
NodeTree = case ets:lookup(gen_mod:get_module_proc(D, config), nodetree) of
NodeTree = case catch ets:lookup(gen_mod:get_module_proc(D, config), nodetree) of
[{nodetree, N}] -> N;
_ -> nodetree_tree
end,