mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 06:05:01 +02:00
FilterUtility::EvaluateFilter(): ensure not to modify the global namespace
(cherry picked from commit bdadb53940f1187d60a4679675af164dbb63f37c)
This commit is contained in:
parent
8315ea86d7
commit
967616d88e
@ -106,6 +106,8 @@ bool FilterUtility::EvaluateFilter(ScriptFrame& frame, Expression *filter,
|
||||
ASSERT(frame.Self.IsObjectType<Namespace>());
|
||||
|
||||
frameNS = frame.Self;
|
||||
|
||||
ASSERT(frameNS != ScriptGlobal::GetGlobals());
|
||||
}
|
||||
|
||||
frameNS->Set("obj", target);
|
||||
@ -256,9 +258,9 @@ std::vector<Value> FilterUtility::GetFilterTargets(const QueryDescription& qd, c
|
||||
if (qd.Types.find(type) == qd.Types.end())
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid type specified for this query."));
|
||||
|
||||
ScriptFrame frame(true);
|
||||
frame.Sandboxed = true;
|
||||
Namespace::Ptr frameNS = new Namespace();
|
||||
ScriptFrame frame(true, frameNS);
|
||||
frame.Sandboxed = true;
|
||||
|
||||
if (query->Contains("filter")) {
|
||||
String filter = HttpUtility::GetLastParameter(query, "filter");
|
||||
@ -272,8 +274,6 @@ std::vector<Value> FilterUtility::GetFilterTargets(const QueryDescription& qd, c
|
||||
}
|
||||
}
|
||||
|
||||
frame.Self = frameNS;
|
||||
|
||||
provider->FindTargets(type, std::bind(&FilteredAddTarget,
|
||||
std::ref(permissionFrame), permissionFilter,
|
||||
std::ref(frame), &*ufilter, std::ref(result), variableName, _1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user