mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
secure calls to ets:lookup
SVN Revision: 2564
This commit is contained in:
parent
de78508f45
commit
3940a6bab3
@ -3468,7 +3468,7 @@ set_xoption([_ | Opts], NewOpts) ->
|
|||||||
is_last_item_cache_enabled({_, ServerHost, _}) ->
|
is_last_item_cache_enabled({_, ServerHost, _}) ->
|
||||||
is_last_item_cache_enabled(ServerHost);
|
is_last_item_cache_enabled(ServerHost);
|
||||||
is_last_item_cache_enabled(Host) ->
|
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;
|
[{last_item_cache, true}] -> true;
|
||||||
_ -> false
|
_ -> false
|
||||||
end.
|
end.
|
||||||
@ -3492,7 +3492,7 @@ get_cached_item({_, ServerHost, _}, NodeId) ->
|
|||||||
get_cached_item(Host, NodeId) ->
|
get_cached_item(Host, NodeId) ->
|
||||||
case is_last_item_cache_enabled(Host) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
true ->
|
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}}] ->
|
[{NodeId, {ItemId, Payload}}] ->
|
||||||
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload};
|
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload};
|
||||||
_ ->
|
_ ->
|
||||||
@ -3506,7 +3506,7 @@ get_cached_item(Host, NodeId) ->
|
|||||||
plugins(Host) when is_binary(Host) ->
|
plugins(Host) when is_binary(Host) ->
|
||||||
plugins(binary_to_list(Host));
|
plugins(binary_to_list(Host));
|
||||||
plugins(Host) when is_list(Host) ->
|
plugins(Host) when is_list(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, []}] -> [?STDNODE];
|
||||||
[{plugins, PL}] -> PL;
|
[{plugins, PL}] -> PL;
|
||||||
_ -> [?STDNODE]
|
_ -> [?STDNODE]
|
||||||
@ -3516,7 +3516,7 @@ select_type(ServerHost, Host, Node, Type) when is_list(ServerHost) ->
|
|||||||
select_type(ServerHost, Host, Node, Type) ->
|
select_type(ServerHost, Host, Node, Type) ->
|
||||||
SelectedType = case Host of
|
SelectedType = case Host of
|
||||||
{_User, _Server, _Resource} ->
|
{_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);
|
[{pep_mapping, PM}] -> proplists:get_value(Node, PM, ?PEPNODE);
|
||||||
_ -> ?PEPNODE
|
_ -> ?PEPNODE
|
||||||
end;
|
end;
|
||||||
@ -3599,7 +3599,7 @@ tree_call({_User, Server, _Resource}, Function, Args) ->
|
|||||||
tree_call(Server, Function, Args);
|
tree_call(Server, Function, Args);
|
||||||
tree_call(Host, Function, Args) ->
|
tree_call(Host, Function, Args) ->
|
||||||
?DEBUG("tree_call ~p ~p ~p",[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;
|
[{nodetree, N}] -> N;
|
||||||
_ -> list_to_atom(?TREE_PREFIX ++ ?STDTREE)
|
_ -> list_to_atom(?TREE_PREFIX ++ ?STDTREE)
|
||||||
end,
|
end,
|
||||||
|
@ -3320,7 +3320,7 @@ set_xoption([_ | Opts], NewOpts) ->
|
|||||||
is_last_item_cache_enabled({_, ServerHost, _}) ->
|
is_last_item_cache_enabled({_, ServerHost, _}) ->
|
||||||
is_last_item_cache_enabled(ServerHost);
|
is_last_item_cache_enabled(ServerHost);
|
||||||
is_last_item_cache_enabled(Host) ->
|
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;
|
[{last_item_cache, true}] -> true;
|
||||||
_ -> false
|
_ -> false
|
||||||
end.
|
end.
|
||||||
@ -3344,7 +3344,7 @@ get_cached_item({_, ServerHost, _}, NodeId) ->
|
|||||||
get_cached_item(Host, NodeId) ->
|
get_cached_item(Host, NodeId) ->
|
||||||
case is_last_item_cache_enabled(Host) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
true ->
|
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}}] ->
|
[{NodeId, {ItemId, Payload}}] ->
|
||||||
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload};
|
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload};
|
||||||
_ ->
|
_ ->
|
||||||
@ -3358,7 +3358,7 @@ get_cached_item(Host, NodeId) ->
|
|||||||
plugins(Host) when is_binary(Host) ->
|
plugins(Host) when is_binary(Host) ->
|
||||||
plugins(binary_to_list(Host));
|
plugins(binary_to_list(Host));
|
||||||
plugins(Host) when is_list(Host) ->
|
plugins(Host) when is_list(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, []}] -> [?STDNODE];
|
||||||
[{plugins, PL}] -> PL;
|
[{plugins, PL}] -> PL;
|
||||||
_ -> [?STDNODE]
|
_ -> [?STDNODE]
|
||||||
@ -3368,7 +3368,7 @@ select_type(ServerHost, Host, Node, Type) when is_list(ServerHost) ->
|
|||||||
select_type(ServerHost, Host, Node, Type) ->
|
select_type(ServerHost, Host, Node, Type) ->
|
||||||
SelectedType = case Host of
|
SelectedType = case Host of
|
||||||
{_User, _Server, _Resource} ->
|
{_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);
|
[{pep_mapping, PM}] -> proplists:get_value(Node, PM, ?PEPNODE);
|
||||||
_ -> ?PEPNODE
|
_ -> ?PEPNODE
|
||||||
end;
|
end;
|
||||||
@ -3451,7 +3451,7 @@ tree_call({_User, Server, _Resource}, Function, Args) ->
|
|||||||
tree_call(Server, Function, Args);
|
tree_call(Server, Function, Args);
|
||||||
tree_call(Host, Function, Args) ->
|
tree_call(Host, Function, Args) ->
|
||||||
?DEBUG("tree_call ~p ~p ~p",[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;
|
[{nodetree, N}] -> N;
|
||||||
_ -> list_to_atom(?TREE_PREFIX ++ ?STDTREE)
|
_ -> list_to_atom(?TREE_PREFIX ++ ?STDTREE)
|
||||||
end,
|
end,
|
||||||
|
@ -595,7 +595,7 @@ purge_node(NodeId, Owner) ->
|
|||||||
get_entity_affiliations(Host, Owner) ->
|
get_entity_affiliations(Host, Owner) ->
|
||||||
GenKey = jlib:short_prepd_bare_jid(Owner),
|
GenKey = jlib:short_prepd_bare_jid(Owner),
|
||||||
States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'}, _ = '_'}),
|
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, N}] -> N;
|
||||||
_ -> nodetree_tree
|
_ -> nodetree_tree
|
||||||
end,
|
end,
|
||||||
@ -650,7 +650,7 @@ get_entity_subscriptions(Host, Owner) ->
|
|||||||
++ mnesia:match_object(
|
++ mnesia:match_object(
|
||||||
#pubsub_state{stateid = {SubKey, '_'}, _ = '_'})
|
#pubsub_state{stateid = {SubKey, '_'}, _ = '_'})
|
||||||
end,
|
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, N}] -> N;
|
||||||
_ -> nodetree_tree
|
_ -> nodetree_tree
|
||||||
end,
|
end,
|
||||||
@ -753,7 +753,7 @@ get_pending_nodes(Host, Owner) ->
|
|||||||
affiliation = owner,
|
affiliation = owner,
|
||||||
_ = '_'}),
|
_ = '_'}),
|
||||||
NodeIDs = [ID || #pubsub_state{stateid = {_, ID}} <- States],
|
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, N}] -> N;
|
||||||
_ -> nodetree_tree
|
_ -> nodetree_tree
|
||||||
end,
|
end,
|
||||||
|
@ -828,7 +828,7 @@ get_pending_nodes(Host, Owner) ->
|
|||||||
affiliation = owner,
|
affiliation = owner,
|
||||||
_ = '_'}),
|
_ = '_'}),
|
||||||
NodeIDs = [ID || #pubsub_state{stateid = {_, ID}} <- States],
|
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, N}] -> N;
|
||||||
_ -> nodetree_tree_odbc
|
_ -> nodetree_tree_odbc
|
||||||
end,
|
end,
|
||||||
|
@ -174,7 +174,7 @@ get_entity_affiliations(_Host, Owner) ->
|
|||||||
SubKey = jlib:jid_tolower(Owner),
|
SubKey = jlib:jid_tolower(Owner),
|
||||||
GenKey = jlib:jid_remove_resource(SubKey),
|
GenKey = jlib:jid_remove_resource(SubKey),
|
||||||
States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'}, _ = '_'}),
|
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, N}] -> N;
|
||||||
_ -> nodetree_tree
|
_ -> nodetree_tree
|
||||||
end,
|
end,
|
||||||
@ -206,7 +206,7 @@ get_entity_subscriptions(_Host, Owner) ->
|
|||||||
++ mnesia:match_object(
|
++ mnesia:match_object(
|
||||||
#pubsub_state{stateid = {SubKey, '_'}, _ = '_'})
|
#pubsub_state{stateid = {SubKey, '_'}, _ = '_'})
|
||||||
end,
|
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, N}] -> N;
|
||||||
_ -> nodetree_tree
|
_ -> nodetree_tree
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user