]> granicus.if.org Git - icinga2/commitdiff
Ensure that config files are readable by the daemon
authorMichael Friedrich <michael.friedrich@netways.de>
Wed, 24 Feb 2016 12:55:25 +0000 (13:55 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Wed, 24 Feb 2016 13:25:09 +0000 (14:25 +0100)
refs #11212
refs #11211

lib/cli/apisetuputility.cpp
lib/cli/nodesetupcommand.cpp
lib/cli/nodeutility.cpp
lib/cli/nodewizardcommand.cpp
lib/cli/repositoryutility.cpp
lib/compat/statusdatawriter.cpp
lib/icinga/clusterevents.cpp
lib/icinga/icingaapplication.cpp

index 56011ca572fc1aa905d4ff1769b6c2a3f00f0ddf..3af432356977516ea8dce9da239e7e39ac9056a2 100644 (file)
@@ -171,7 +171,7 @@ bool ApiSetupUtility::SetupMasterApiUser(void)
        NodeUtility::CreateBackupFile(apiUsersPath);
 
        std::fstream fp;
-       String tempFilename = Utility::CreateTempFile(apiUsersPath + ".XXXXXX", 0640, fp);
+       String tempFilename = Utility::CreateTempFile(apiUsersPath + ".XXXXXX", 0644, fp);
 
        fp << "/**\n"
            << " * The APIUser objects are used for authentication against the API.\n"
index 0eb34b3b763674c27538b8ecfc715fb0f939700e..ed0126ce8973b1ba50b58816c526bcb6c9cbd644 100644 (file)
@@ -170,7 +170,7 @@ int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& v
        NodeUtility::CreateBackupFile(apipath);
 
        std::fstream fp;
-       String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0640, fp);
+       String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0644, fp);
 
        fp << "/**\n"
            << " * The API listener is used for distributed monitoring setups.\n"
@@ -375,7 +375,7 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
        NodeUtility::CreateBackupFile(apipath);
 
        std::fstream fp;
-       String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0640, fp);
+       String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0644, fp);
 
        fp << "/**\n"
            << " * The API listener is used for distributed monitoring setups.\n"
index 49741fe85697e56e650c53e441d362027426a898..b096b2490ae0123919ea77c2af5f73621600d504 100644 (file)
@@ -386,7 +386,7 @@ bool NodeUtility::WriteNodeConfigObjects(const String& filename, const Array::Pt
        }
 
        std::fstream fp;
-       String tempFilename = Utility::CreateTempFile(filename + ".XXXXXX", 0640, fp);
+       String tempFilename = Utility::CreateTempFile(filename + ".XXXXXX", 0644, fp);
 
        fp << "/*\n";
        fp << " * Generated by Icinga 2 node setup commands\n";
@@ -640,7 +640,7 @@ void NodeUtility::UpdateConstant(const String& name, const String& value)
 
        std::ifstream ifp(constantsFile.CStr());
        std::fstream ofp;
-       String tempFile = Utility::CreateTempFile(constantsFile + ".XXXXXX", 0640, ofp);
+       String tempFile = Utility::CreateTempFile(constantsFile + ".XXXXXX", 0644, ofp);
 
        bool found = false;
 
index 87aeb4763b22935e67e03690aa04c290c31de7f2..9c89196d07ebcee7551b1fa1b59666cb96085696 100644 (file)
@@ -413,7 +413,7 @@ wizard_ticket:
                NodeUtility::CreateBackupFile(apipath);
 
                std::fstream fp;
-               String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0640, fp);
+               String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0644, fp);
 
                fp << "/**\n"
                    << " * The API listener is used for distributed monitoring setups.\n"
@@ -538,7 +538,7 @@ wizard_ticket:
 
 
                std::fstream fp;
-               String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0640, fp);
+               String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0644, fp);
 
                fp << "/**\n"
                    << " * The API listener is used for distributed monitoring setups.\n"
index a4d43938ebe8645dde51d233c005f35d94d08860..f2dc510638ee54eb0d971d8d8eefd7999b2e6d30 100644 (file)
@@ -497,7 +497,7 @@ bool RepositoryUtility::WriteObjectToRepository(const String& path, const String
        CreateRepositoryPath(Utility::DirName(path));
 
        std::fstream fp;
-       String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0640, fp);
+       String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0644, fp);
 
        SerializeObject(fp, name, type, item);
        fp << std::endl;
index 0986fdfdf6d4c1af43fc2a36087fb6407c63e1c0..134174f7018a8629ab0151c705d92c883dd16e75 100644 (file)
@@ -539,7 +539,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
        String objectsPath = GetObjectsPath();
 
        std::fstream objectfp;
-       String tempObjectsPath = Utility::CreateTempFile(objectsPath + ".XXXXXX", 0640, objectfp);
+       String tempObjectsPath = Utility::CreateTempFile(objectsPath + ".XXXXXX", 0644, objectfp);
 
        objectfp << std::fixed;
 
@@ -785,7 +785,7 @@ void StatusDataWriter::StatusTimerHandler(void)
        String statusPath = GetStatusPath();
 
        std::fstream statusfp;
-       String tempStatusPath = Utility::CreateTempFile(statusPath + ".XXXXXX", 0640, statusfp);
+       String tempStatusPath = Utility::CreateTempFile(statusPath + ".XXXXXX", 0644, statusfp);
 
        statusfp << std::fixed;
 
index eaf2e62ad306ec2b690df829026a65fc22969b5c..34ff84042ca1152b39151dd5750d182fd1d45d7f 100644 (file)
@@ -724,7 +724,7 @@ Value ClusterEvents::UpdateRepositoryAPIHandler(const MessageOrigin::Ptr& origin
        String repositoryFile = GetRepositoryDir() + SHA256(params->Get("endpoint")) + ".repo";
 
        std::fstream fp;
-       String tempRepositoryFile = Utility::CreateTempFile(repositoryFile + ".XXXXXX", 0640, fp);
+       String tempRepositoryFile = Utility::CreateTempFile(repositoryFile + ".XXXXXX", 0644, fp);
 
        fp << JsonEncode(params);
        fp.close();
index 9bbd81583f37cbe6cbb43139ca188cc774614a76..26f41d0b20d852f89bc4051de86abeac1e04b3e2 100644 (file)
@@ -175,7 +175,7 @@ void IcingaApplication::DumpModifiedAttributes(void)
        String path = GetModAttrPath();
 
        std::fstream fp;
-       String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0640, fp);
+       String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0644, fp);
 
        ConfigObject::Ptr previousObject;
        ConfigObject::DumpModifiedAttributes(boost::bind(&PersistModAttrHelper, boost::ref(fp), boost::ref(previousObject), _1, _2, _3));