aboutsummaryrefslogtreecommitdiff
path: root/src/configparser.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-03-30 10:12:41 +0100
committerGravatar Sadie Powell2021-03-30 10:12:41 +0100
commitf602febac5b4f5f26c1b681b2c5139965c85ad06 (patch)
tree8c469ac3259caa23c87e75bdd397e86fe887f959 /src/configparser.cpp
parentAlways disable TLSv1.0 and disable TLSv1.1 by default. (diff)
parentAdd support for matching multiple hosts in <connect:{allow,deny}>. (diff)
Merge branch 'insp3' into master.
Diffstat (limited to 'src/configparser.cpp')
-rw-r--r--src/configparser.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp
index 84b300121..b4814123d 100644
--- a/src/configparser.cpp
+++ b/src/configparser.cpp
@@ -38,7 +38,10 @@ enum ParseFlags
FLAG_NO_INC = 4,
// &env.FOO; is disabled.
- FLAG_NO_ENV = 8
+ FLAG_NO_ENV = 8,
+
+ // It's okay if an include doesn't exist.
+ FLAG_MISSING_OKAY = 16
};
// RAII wrapper for FILE* which closes the file when it goes out of scope.
@@ -370,11 +373,18 @@ void ParseStack::DoInclude(std::shared_ptr<ConfigTag> tag, int flags)
{
if (tag->getBool("noinclude", false))
flags |= FLAG_NO_INC;
+
if (tag->getBool("noexec", false))
flags |= FLAG_NO_EXEC;
+
if (tag->getBool("noenv", false))
flags |= FLAG_NO_ENV;
+ if (tag->getBool("missingokay", false))
+ flags |= FLAG_MISSING_OKAY;
+ else
+ flags &= ~FLAG_MISSING_OKAY;
+
if (!ParseFile(ServerInstance->Config->Paths.PrependConfig(name), flags, mandatorytag))
throw CoreException("Included");
}
@@ -459,7 +469,12 @@ bool ParseStack::ParseFile(const std::string& path, int flags, const std::string
FileWrapper file((isexec ? popen(path.c_str(), "r") : fopen(path.c_str(), "r")), isexec);
if (!file)
+ {
+ if (flags & FLAG_MISSING_OKAY)
+ return true;
+
throw CoreException("Could not read \"" + path + "\" for include");
+ }
reading.push_back(path);
Parser p(*this, flags, file, path, mandatory_tag);