aboutsummaryrefslogtreecommitdiff
path: root/src/configparser.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-11-16 16:29:12 +0000
committerGravatar Sadie Powell2022-11-16 16:29:12 +0000
commit92739a57f6020f07fcc27b80f19869bd85369dcb (patch)
treea1c19b2ee89521c2ecb023ad8920491ddd82adfc /src/configparser.cpp
parentRelease v4.0.0 alpha 16. (diff)
parentUpdate the Windows dependencies. (diff)
Merge branch 'insp3' into master.
Diffstat (limited to 'src/configparser.cpp')
-rw-r--r--src/configparser.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp
index cbbfdc755..fbbc774ae 100644
--- a/src/configparser.cpp
+++ b/src/configparser.cpp
@@ -418,10 +418,27 @@ void ParseStack::DoInclude(std::shared_ptr<ConfigTag> tag, int flags)
FilePtr ParseStack::DoOpenFile(const std::string& name, bool isexec)
{
ServerInstance->Logs.Debug("CONFIG", "Opening %s: %s", isexec ? "executable" : "file", name.c_str());
+
if (isexec)
return FilePtr(popen(name.c_str(), "r"), pclose);
- else
- return FilePtr(fopen(name.c_str(), "r"), fclose);
+
+#ifndef _WIN32
+ struct stat pathinfo;
+ if (stat(name.c_str(), &pathinfo) == 0)
+ {
+ if (getegid() != pathinfo.st_gid)
+ {
+ ServerInstance->Logs.Normal("CONFIG", "Possible configuration error: %s is owned by group %u but the server is running as group %u.",
+ name.c_str(), pathinfo.st_gid, getegid());
+ }
+ if (geteuid() != pathinfo.st_uid)
+ {
+ ServerInstance->Logs.Normal("CONFIG", "Possible configuration error: %s is owned by user %u but the server is running as user %u.",
+ name.c_str(), pathinfo.st_uid, geteuid());
+ }
+ }
+#endif
+ return FilePtr(fopen(name.c_str(), "r"), fclose);
}
void ParseStack::DoReadFile(const std::string& key, const std::string& name, int flags, bool exec)