From e877fb41803c301e28179bcd52d9912ebd37dc93 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 2 Apr 2005 19:03:38 +0000 Subject: Config files read by the ircd are now chmod'ed 0600 git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@951 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd_io.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/inspircd_io.cpp') diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index 19f853ddb..685e84865 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -268,12 +268,16 @@ bool LoadConf(const char* filename, std::stringstream *target, std::stringstream target->str(""); errorstream->str(""); long linenumber = 1; - FILE* conf = fopen(filename,"r"); + // first, check that the file exists before we try to do anything with it if (!FileExists(filename)) { *errorstream << "File " << filename << " not found." << endl; return false; } + // Fix the chmod of the file to restrict it to the current user and group + chmod(filename,0600); + // now open it + FILE* conf = fopen(filename,"r"); char buffer[MAXBUF]; if (conf) { -- cgit v1.2.3