MCPcopy Create free account
hub / github.com/Icinga/icinga2 / FindTargets

Method FindTargets

lib/remote/variablequeryhandler.cpp:22–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 DECLARE_PTR_TYPEDEFS(VariableTargetProvider);
21
22 void FindTargets([[maybe_unused]] const String& type,
23 const std::function<void (const Value&)>& addTarget) const override
24 {
25 Namespace::Ptr globals = ScriptGlobal::GetGlobals();
26 ObjectLock olock(globals);
27 for (auto& [key, value] : globals) {
28 /* We want wo avoid leaking the TicketSalt over the API, so we remove it here,
29 * as early as possible, so it isn't possible to abuse the fact that all of the
30 * global variables we return here later get checked against a user-provided
31 * filter expression that can cause its content to be printed in an error message
32 * or potentially access them otherwise.
33 */
34 if (key == "TicketSalt") {
35 continue;
36 }
37
38 addTarget(FilterUtility::GetTargetForVar(key, value.Val));
39 }
40 }
41
42 Value GetTargetByName([[maybe_unused]] const String& type, const String& name) const override
43 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected