[icinga-checkins] icinga.org: icinga2/support/2.4: Ensure that config files are readable by the daemon

git at icinga.org git at icinga.org
Wed Feb 24 14:29:10 CET 2016


Module: icinga2
Branch: support/2.4
Commit: e4b99ca87e41ef78a844569a89510523e3c22f47
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=e4b99ca87e41ef78a844569a89510523e3c22f47

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Wed Feb 24 13:55:25 2016 +0100

Ensure that config files are readable by the daemon

refs #11212
refs #11211

---

 lib/cli/apisetuputility.cpp      |    2 +-
 lib/cli/nodesetupcommand.cpp     |    4 ++--
 lib/cli/nodeutility.cpp          |    4 ++--
 lib/cli/nodewizardcommand.cpp    |    4 ++--
 lib/cli/repositoryutility.cpp    |    2 +-
 lib/compat/statusdatawriter.cpp  |    4 ++--
 lib/icinga/clusterevents.cpp     |    2 +-
 lib/icinga/icingaapplication.cpp |    2 +-
 8 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/lib/cli/apisetuputility.cpp b/lib/cli/apisetuputility.cpp
index 56011ca..3af4323 100644
--- a/lib/cli/apisetuputility.cpp
+++ b/lib/cli/apisetuputility.cpp
@@ -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"
diff --git a/lib/cli/nodesetupcommand.cpp b/lib/cli/nodesetupcommand.cpp
index 0eb34b3..ed0126c 100644
--- a/lib/cli/nodesetupcommand.cpp
+++ b/lib/cli/nodesetupcommand.cpp
@@ -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"
diff --git a/lib/cli/nodeutility.cpp b/lib/cli/nodeutility.cpp
index 49741fe..b096b24 100644
--- a/lib/cli/nodeutility.cpp
+++ b/lib/cli/nodeutility.cpp
@@ -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;
 
diff --git a/lib/cli/nodewizardcommand.cpp b/lib/cli/nodewizardcommand.cpp
index 87aeb47..9c89196 100644
--- a/lib/cli/nodewizardcommand.cpp
+++ b/lib/cli/nodewizardcommand.cpp
@@ -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"
diff --git a/lib/cli/repositoryutility.cpp b/lib/cli/repositoryutility.cpp
index a4d4393..f2dc510 100644
--- a/lib/cli/repositoryutility.cpp
+++ b/lib/cli/repositoryutility.cpp
@@ -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;
diff --git a/lib/compat/statusdatawriter.cpp b/lib/compat/statusdatawriter.cpp
index 0986fdf..134174f 100644
--- a/lib/compat/statusdatawriter.cpp
+++ b/lib/compat/statusdatawriter.cpp
@@ -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;
 
diff --git a/lib/icinga/clusterevents.cpp b/lib/icinga/clusterevents.cpp
index eaf2e62..34ff840 100644
--- a/lib/icinga/clusterevents.cpp
+++ b/lib/icinga/clusterevents.cpp
@@ -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();
diff --git a/lib/icinga/icingaapplication.cpp b/lib/icinga/icingaapplication.cpp
index 9bbd815..26f41d0 100644
--- a/lib/icinga/icingaapplication.cpp
+++ b/lib/icinga/icingaapplication.cpp
@@ -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));



More information about the icinga-checkins mailing list