[icinga-checkins] icinga.org: icinga2/master: Fix incorrect hash size for User objects

git at icinga.org git at icinga.org
Thu Aug 25 07:38:03 CEST 2016


Module: icinga2
Branch: master
Commit: 225bb8029a18d7cda6a2a2ac5773ccbaac96555c
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=225bb8029a18d7cda6a2a2ac5773ccbaac96555c

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Thu Aug 25 07:37:41 2016 +0200

Fix incorrect hash size for User objects

fixes #12533

---

 lib/db_ido/dbconnection.cpp |    1 +
 lib/db_ido/userdbobject.cpp |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/db_ido/dbconnection.cpp b/lib/db_ido/dbconnection.cpp
index 8407a57..1d4e228 100644
--- a/lib/db_ido/dbconnection.cpp
+++ b/lib/db_ido/dbconnection.cpp
@@ -444,6 +444,7 @@ void DbConnection::UpdateObject(const ConfigObject::Ptr& object)
 
 			Dictionary::Ptr configFields = dbobj->GetConfigFields();
 			String configHash = dbobj->CalculateConfigHash(configFields);
+			ASSERT(configHash.GetLength() <= 64);
 			configFields->Set("config_hash", configHash);
 
 			String cachedHash = GetConfigHash(dbobj);
diff --git a/lib/db_ido/userdbobject.cpp b/lib/db_ido/userdbobject.cpp
index bedada1..aa3b113 100644
--- a/lib/db_ido/userdbobject.cpp
+++ b/lib/db_ido/userdbobject.cpp
@@ -174,5 +174,5 @@ String UserDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
 	if (groups)
 		hashData += DbObject::HashValue(groups);
 
-	return hashData;
+	return SHA256(hashData);
 }



More information about the icinga-checkins mailing list