]> granicus.if.org Git - icinga2/commitdiff
Fix that relative paths do not work with include_zones
authorMichael Friedrich <michael.friedrich@netways.de>
Fri, 11 Dec 2015 15:58:43 +0000 (16:58 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Fri, 11 Dec 2015 15:58:43 +0000 (16:58 +0100)
fixes #10828

lib/config/configcompiler.cpp

index 9aed686b316d05bfcdfb799bbb1a4282089af60e..1bda22670a507a22913f8c938a5219df24ec32b3 100644 (file)
@@ -212,14 +212,17 @@ Expression *ConfigCompiler::HandleIncludeZones(const String& relativeBase, const
     const String& path, const String& pattern, const String& package, const DebugInfo&)
 {
        String ppath;
+       String newRelativeBase = relativeBase;
 
        if (path.GetLength() > 0 && path[0] == '/')
                ppath = path;
-       else
+       else {
                ppath = relativeBase + "/" + path;
+               newRelativeBase = ".";
+       }
 
        std::vector<Expression *> expressions;
-       Utility::Glob(ppath + "/*", boost::bind(&ConfigCompiler::HandleIncludeZone, relativeBase, tag, _1, pattern, package, boost::ref(expressions)), GlobDirectory);
+       Utility::Glob(ppath + "/*", boost::bind(&ConfigCompiler::HandleIncludeZone, newRelativeBase, tag, _1, pattern, package, boost::ref(expressions)), GlobDirectory);
        return new DictExpression(expressions);
 }