]> granicus.if.org Git - icinga2/commitdiff
Build fix for Debian wheezy 5939/head
authorGunnar Beutner <gunnar.beutner@icinga.com>
Wed, 3 Jan 2018 09:19:24 +0000 (10:19 +0100)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Wed, 3 Jan 2018 09:32:33 +0000 (10:32 +0100)
20 files changed:
icinga-app/icinga.cpp
lib/base/function.cpp
lib/base/scriptframe.cpp
lib/base/scriptframe.hpp
lib/cli/consolecommand.cpp
lib/cli/daemonutility.cpp
lib/config/configfragment.hpp
lib/config/configitem.cpp
lib/icinga/dependency-apply.cpp
lib/icinga/hostgroup.cpp
lib/icinga/notification-apply.cpp
lib/icinga/scheduleddowntime-apply.cpp
lib/icinga/service-apply.cpp
lib/icinga/servicegroup.cpp
lib/icinga/usergroup.cpp
lib/remote/configobjectutility.cpp
lib/remote/consolehandler.cpp
lib/remote/eventqueue.cpp
lib/remote/filterutility.cpp
test/config-ops.cpp

index 0a25e691e0dc211f2ca4f0b90c2b8cd4a0274987..69d796be0381ba4220317cc4d25e7768c03ff27f 100644 (file)
@@ -180,7 +180,7 @@ static int Main(void)
                try {
                        expression = ConfigCompiler::CompileFile(initconfig);
 
-                       ScriptFrame frame;
+                       ScriptFrame frame(true);
                        expression->Evaluate(frame);
                } catch (const std::exception& ex) {
                        Log(LogCritical, "config", DiagnosticInformation(ex));
index 3c3d690f8fea9a39cfd8c12a41ae148f1dd94f6b..d79e78725bb16f664939711d52e91324d6273b06 100644 (file)
@@ -44,7 +44,7 @@ Value Function::Invoke(const std::vector<Value>& arguments)
 
 Value Function::InvokeThis(const Value& otherThis, const std::vector<Value>& arguments)
 {
-       ScriptFrame frame(otherThis, false);
+       ScriptFrame frame(false, otherThis);
        return m_Callback(arguments);
 }
 
index da6c29a06260d8a99a108dbbf1118512dd1b2d1c..7d4367926b1ee7e23e36a5a4c10c5338a339e640 100644 (file)
@@ -46,7 +46,7 @@ ScriptFrame::ScriptFrame(bool allocLocals)
        InitializeFrame();
 }
 
-ScriptFrame::ScriptFrame(const Value& self, bool allocLocals)
+ScriptFrame::ScriptFrame(bool allocLocals, const Value& self)
        : Locals(allocLocals ? new Dictionary() : nullptr), Self(self), Sandboxed(false), Depth(0)
 {
        InitializeFrame();
index 8de9360cfdc4e46772d7ede1409ca5376c777842..41f68f31eb2da7f071582b97383c9e1709545112 100644 (file)
@@ -36,8 +36,8 @@ struct I2_BASE_API ScriptFrame
        bool Sandboxed;
        int Depth;
 
-       ScriptFrame(bool allocLocals = true);
-       ScriptFrame(const Value& self, bool allocLocals = true);
+       ScriptFrame(bool allocLocals);
+       ScriptFrame(bool allocLocals, const Value& self);
        ~ScriptFrame(void);
 
        void IncreaseStackDepth(void);
index 0a00c469cc68c64fe83d0fe205025b3a63ce1064..e5664eef8f874bdbfb0cd30283e99659dc60b843 100644 (file)
@@ -50,7 +50,7 @@ INITIALIZE_ONCE(&ConsoleCommand::StaticInitialize);
 
 extern "C" void dbg_spawn_console(void)
 {
-       ScriptFrame frame;
+       ScriptFrame frame(true);
        ConsoleCommand::RunScriptConsole(frame);
 }
 
@@ -71,7 +71,7 @@ extern "C" void dbg_eval(const char *text)
        std::unique_ptr<Expression> expr;
 
        try {
-               ScriptFrame frame;
+               ScriptFrame frame(true);
                expr = ConfigCompiler::CompileText("<dbg>", text);
                Value result = Serialize(expr->Evaluate(frame), 0);
                dbg_inspect_value(result);
@@ -85,7 +85,7 @@ extern "C" void dbg_eval_with_value(const Value& value, const char *text)
        std::unique_ptr<Expression> expr;
 
        try {
-               ScriptFrame frame;
+               ScriptFrame frame(true);
                frame.Locals = new Dictionary();
                frame.Locals->Set("arg", value);
                expr = ConfigCompiler::CompileText("<dbg>", text);
@@ -101,7 +101,7 @@ extern "C" void dbg_eval_with_object(Object *object, const char *text)
        std::unique_ptr<Expression> expr;
 
        try {
-               ScriptFrame frame;
+               ScriptFrame frame(true);
                frame.Locals = new Dictionary();
                frame.Locals->Set("arg", object);
                expr = ConfigCompiler::CompileText("<dbg>", text);
@@ -227,7 +227,7 @@ int ConsoleCommand::Run(const po::variables_map& vm, const std::vector<std::stri
 #endif /* HAVE_EDITLINE */
 
        String addr, session;
-       ScriptFrame scriptFrame;
+       ScriptFrame scriptFrame(true);
 
        session = Utility::NewUniqueID();
 
index 0df88f666f14df150abecc4957a6a47bbdb7658b..02e31e272584b120bf0124857c97e6310352221b 100644 (file)
@@ -34,7 +34,7 @@ static bool ExecuteExpression(Expression *expression)
                return false;
 
        try {
-               ScriptFrame frame;
+               ScriptFrame frame(true);
                expression->Evaluate(frame);
        } catch (const std::exception& ex) {
                Log(LogCritical, "config", DiagnosticInformation(ex));
index 59fb9a585bdf3d830d01e89d57b03cf933a9e670..bd3c5939baf2dae937bc8c03d6157ab797a7edca 100644 (file)
@@ -31,7 +31,7 @@
                std::unique_ptr<icinga::Expression> expression = icinga::ConfigCompiler::CompileText(name, fragment); \
                VERIFY(expression); \
                try { \
-                       icinga::ScriptFrame frame; \
+                       icinga::ScriptFrame frame(true); \
                        expression->Evaluate(frame); \
                } catch (const std::exception& ex) { \
                        std::cerr << icinga::DiagnosticInformation(ex) << std::endl; \
index 525f81df5d14137753555ad3db498b7e325dd7e1..0d501ef6f170ee498d28ed60426818b862c3c903 100644 (file)
@@ -196,7 +196,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
 
        DebugHint debugHints;
 
-       ScriptFrame frame(dobj);
+       ScriptFrame frame(true, dobj);
        if (m_Scope)
                m_Scope->CopyTo(frame.Locals);
        try {
@@ -584,7 +584,7 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr
 
                        if (expression) {
                                try {
-                                       ScriptFrame frame;
+                                       ScriptFrame frame(true);
                                        expression->Evaluate(frame);
                                } catch (const std::exception& ex) {
                                        Log(LogCritical, "config", DiagnosticInformation(ex));
index 2871b6058d40ac3952cda89c6bbfaafe8de5749b..72d2aa915d672393375c2aa85a3d89f70b9a2a4e 100644 (file)
@@ -91,7 +91,7 @@ bool Dependency::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyR
        Service::Ptr service;
        tie(host, service) = GetHostService(checkable);
 
-       ScriptFrame frame;
+       ScriptFrame frame(true);
        if (rule.GetScope())
                rule.GetScope()->CopyTo(frame.Locals);
        frame.Locals->Set("host", host);
index d729d29e7b0a632734df7d91465a7d2963fd44ee..1d386396f14e672e30a3621af0116abde5c3175f 100644 (file)
@@ -41,7 +41,7 @@ bool HostGroup::EvaluateObjectRule(const Host::Ptr& host, const ConfigItem::Ptr&
 
        CONTEXT("Evaluating rule for group '" + group_name + "'");
 
-       ScriptFrame frame;
+       ScriptFrame frame(true);
        if (group->GetScope())
                group->GetScope()->CopyTo(frame.Locals);
        frame.Locals->Set("host", host);
index 06bae342dfb7720cf93364adcce6e6338b14d581..9573315a4050ad37081ef86111eba9e659df9b4d 100644 (file)
@@ -90,7 +90,7 @@ bool Notification::EvaluateApplyRule(const Checkable::Ptr& checkable, const Appl
        Service::Ptr service;
        tie(host, service) = GetHostService(checkable);
 
-       ScriptFrame frame;
+       ScriptFrame frame(true);
        if (rule.GetScope())
                rule.GetScope()->CopyTo(frame.Locals);
        frame.Locals->Set("host", host);
index de2a682ff5ad803739486ffeaff8f2ca654d56d2..2c2ec4a14ff8bdd5e25b86e9876e66d8ac857b59 100644 (file)
@@ -89,7 +89,7 @@ bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const
        Service::Ptr service;
        tie(host, service) = GetHostService(checkable);
 
-       ScriptFrame frame;
+       ScriptFrame frame(true);
        if (rule.GetScope())
                rule.GetScope()->CopyTo(frame.Locals);
        frame.Locals->Set("host", host);
index f16c13f22184e2c3d22803c7335a9c17ec34f9cd..d9a01c9808da96af57409ed9a72a84c3fb2d9b38 100644 (file)
@@ -80,7 +80,7 @@ bool Service::EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule)
        msgbuf << "Evaluating 'apply' rule (" << di << ")";
        CONTEXT(msgbuf.str());
 
-       ScriptFrame frame;
+       ScriptFrame frame(true);
        if (rule.GetScope())
                rule.GetScope()->CopyTo(frame.Locals);
        frame.Locals->Set("host", host);
index 2b5363625d17aa0a957fec63b3153bfe80aaf720..5b2b43aac5fc6a690c22cd02568c2b5f73c46961 100644 (file)
@@ -43,7 +43,7 @@ bool ServiceGroup::EvaluateObjectRule(const Service::Ptr& service, const ConfigI
 
        Host::Ptr host = service->GetHost();
 
-       ScriptFrame frame;
+       ScriptFrame frame(true);
        if (group->GetScope())
                group->GetScope()->CopyTo(frame.Locals);
        frame.Locals->Set("host", host);
index ab1923d66747cd4f8e1d4fb8500ffa06bd58145c..e1740e35ad2fff6ac602328aee7cde667967f1d0 100644 (file)
@@ -41,7 +41,7 @@ bool UserGroup::EvaluateObjectRule(const User::Ptr& user, const ConfigItem::Ptr&
 
        CONTEXT("Evaluating rule for group '" + group_name + "'");
 
-       ScriptFrame frame;
+       ScriptFrame frame(true);
        if (group->GetScope())
                group->GetScope()->CopyTo(frame.Locals);
        frame.Locals->Set("user", user);
index 181c0152b74425dc78b9ebc3d3706e6ce88b2d82..5207e515bd3354818393559a9c37e01b96e60116 100644 (file)
@@ -129,7 +129,7 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full
        try {
                ActivationScope ascope;
 
-               ScriptFrame frame;
+               ScriptFrame frame(true);
                expr->Evaluate(frame);
                expr.reset();
 
index 72e544a2f28dc5cf47b796c275c37079d5036216..1f32bb725ab3f45af277d0f0190f6a206c74a900 100644 (file)
@@ -129,7 +129,7 @@ bool ConsoleHandler::ExecuteScriptHelper(HttpRequest& request, HttpResponse& res
        try {
                expr = ConfigCompiler::CompileText(fileName, command);
 
-               ScriptFrame frame;
+               ScriptFrame frame(true);
                frame.Locals = lsf.Locals;
                frame.Self = lsf.Locals;
                frame.Sandboxed = sandboxed;
@@ -190,7 +190,7 @@ bool ConsoleHandler::AutocompleteScriptHelper(HttpRequest& request, HttpResponse
        Array::Ptr results = new Array();
        Dictionary::Ptr resultInfo = new Dictionary();
 
-       ScriptFrame frame;
+       ScriptFrame frame(true);
        frame.Locals = lsf.Locals;
        frame.Self = lsf.Locals;
        frame.Sandboxed = sandboxed;
index 591e0222aa80b5f697b474c5a183cde41f2ecc05..105a448d76ead197f08886decc59ce01a1edd27f 100644 (file)
@@ -37,7 +37,7 @@ bool EventQueue::CanProcessEvent(const String& type) const
 
 void EventQueue::ProcessEvent(const Dictionary::Ptr& event)
 {
-       ScriptFrame frame;
+       ScriptFrame frame(true);
        frame.Sandboxed = true;
 
        try {
index e864482f2c9a1710c02d70451ad1ae87a6ecfbac..826e5e827a5fceb998e4f79e956d62eae4b75c01 100644 (file)
@@ -197,7 +197,7 @@ std::vector<Value> FilterUtility::GetFilterTargets(const QueryDescription& qd, c
        Expression *permissionFilter;
        CheckPermission(user, qd.Permission, &permissionFilter);
 
-       ScriptFrame permissionFrame;
+       ScriptFrame permissionFrame(true);
 
        for (const String& type : qd.Types) {
                String attr = type;
@@ -247,7 +247,7 @@ 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;
+               ScriptFrame frame(true);
                frame.Sandboxed = true;
                Dictionary::Ptr uvars = new Dictionary();
 
index 9ec91ff882c6595398558f6705a64ce7ae83a482..ac7817d3713bce639e0a9a61ee75facbdf3da344 100644 (file)
@@ -27,7 +27,7 @@ BOOST_AUTO_TEST_SUITE(config_ops)
 
 BOOST_AUTO_TEST_CASE(simple)
 {
-       ScriptFrame frame;
+       ScriptFrame frame(true);
        std::unique_ptr<Expression> expr;
        Dictionary::Ptr dict;
 
@@ -168,7 +168,7 @@ BOOST_AUTO_TEST_CASE(simple)
 
 BOOST_AUTO_TEST_CASE(advanced)
 {
-       ScriptFrame frame;
+       ScriptFrame frame(true);
        std::unique_ptr<Expression> expr;
        Function::Ptr func;
 
@@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(advanced)
        BOOST_CHECK_THROW(expr->Evaluate(frame).GetValue(), ScriptError);
 
        Object::Ptr self = new Object();
-       ScriptFrame frame2(self);
+       ScriptFrame frame2(true, self);
        expr = ConfigCompiler::CompileText("<test>", "this");
        BOOST_CHECK(expr->Evaluate(frame2).GetValue() == Value(self));