mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-02 06:55:16 +00:00
[#1382] Set initial audit time to 2000-01-01
Modified the audit entry time from which initially incremental config changes are fetched when the server boots up. Previously it was 1970-01-01, however it caused issues for some MariaDB versions. MariaDB can only use timestamps later than 1970-01-01 UTC.
This commit is contained in:
@@ -92,7 +92,7 @@ public:
|
|||||||
|
|
||||||
/// @brief Constructor.
|
/// @brief Constructor.
|
||||||
///
|
///
|
||||||
/// Sets the time of the last fetched audit entry to Jan 1st, 1970,
|
/// Sets the time of the last fetched audit entry to Jan 1st, 2000,
|
||||||
/// with id 0.
|
/// with id 0.
|
||||||
CBControlBase()
|
CBControlBase()
|
||||||
: last_audit_revision_time_(getInitialAuditRevisionTime()),
|
: last_audit_revision_time_(getInitialAuditRevisionTime()),
|
||||||
@@ -316,10 +316,10 @@ protected:
|
|||||||
/// @brief Convenience method returning initial timestamp to set the
|
/// @brief Convenience method returning initial timestamp to set the
|
||||||
/// @c last_audit_revision_time_ to.
|
/// @c last_audit_revision_time_ to.
|
||||||
///
|
///
|
||||||
/// @return Returns 1970-Jan-01 00:00:00 in local time.
|
/// @return Returns 2000-Jan-01 00:00:00 in local time.
|
||||||
static boost::posix_time::ptime getInitialAuditRevisionTime() {
|
static boost::posix_time::ptime getInitialAuditRevisionTime() {
|
||||||
static boost::posix_time::ptime
|
static boost::posix_time::ptime
|
||||||
initial_time(boost::gregorian::date(1970, boost::gregorian::Jan, 1));
|
initial_time(boost::gregorian::date(2000, boost::gregorian::Jan, 1));
|
||||||
return (initial_time);
|
return (initial_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include <config_backend/base_config_backend_pool.h>
|
#include <config_backend/base_config_backend_pool.h>
|
||||||
#include <process/cb_ctl_base.h>
|
#include <process/cb_ctl_base.h>
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
#include <boost/date_time/gregorian/gregorian.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -419,6 +420,20 @@ TEST_F(CBControlBaseTest, getMgr) {
|
|||||||
EXPECT_EQ(TEST_INSTANCE_ID, mgr.getInstanceId());
|
EXPECT_EQ(TEST_INSTANCE_ID, mgr.getInstanceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This test verifies that the initial audit revision time is set to
|
||||||
|
// local time of 2000-01-01.
|
||||||
|
TEST_F(CBControlBaseTest, getInitialAuditRevisionTime) {
|
||||||
|
auto initial_time = cb_ctl_.getInitialAuditRevisionTime();
|
||||||
|
ASSERT_FALSE(initial_time.is_not_a_date_time());
|
||||||
|
auto tm = boost::posix_time::to_tm(initial_time);
|
||||||
|
EXPECT_EQ(100, tm.tm_year);
|
||||||
|
EXPECT_EQ(0, tm.tm_mon);
|
||||||
|
EXPECT_EQ(0, tm.tm_yday);
|
||||||
|
EXPECT_EQ(0, tm.tm_hour);
|
||||||
|
EXPECT_EQ(0, tm.tm_min);
|
||||||
|
EXPECT_EQ(0, tm.tm_sec);
|
||||||
|
}
|
||||||
|
|
||||||
// This test verifies that last audit entry time is reset upon the
|
// This test verifies that last audit entry time is reset upon the
|
||||||
// call to CBControlBase::reset().
|
// call to CBControlBase::reset().
|
||||||
TEST_F(CBControlBaseTest, reset) {
|
TEST_F(CBControlBaseTest, reset) {
|
||||||
|
Reference in New Issue
Block a user