Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
f48f9eba
Commit
f48f9eba
authored
Mar 11, 2015
by
Marcin Siodelski
Browse files
[3673] Updated comments about the max timestamp for the MySQL and PgSQL.
parent
4ba876ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcpsrv/mysql_lease_mgr.cc
View file @
f48f9eba
...
...
@@ -1287,7 +1287,8 @@ MySqlLeaseMgr::convertToDatabaseTime(const time_t cltt,
int64_t
expire_time_64
=
static_cast
<
int64_t
>
(
cltt
)
+
static_cast
<
int64_t
>
(
valid_lifetime
);
// Prevent too large value.
// Even on 64-bit systems MySQL doesn't seem to accept the timestamps
// beyond the max value of int32_t.
if
(
expire_time_64
>
LeaseMgr
::
MAX_DB_TIME
)
{
isc_throw
(
BadValue
,
"Time value is too large: "
<<
expire_time_64
);
}
...
...
src/lib/dhcpsrv/pgsql_lease_mgr.cc
View file @
f48f9eba
...
...
@@ -315,10 +315,10 @@ public:
int64_t
expire_time_64
=
static_cast
<
int64_t
>
(
cltt
)
+
static_cast
<
int64_t
>
(
valid_lifetime
);
//
PostgreSQL does funny things wi
th time
if you get past Y2038. It
//
will accept the values (unlike MySQL which thr
ows
)
b
ut it
//
s
to
ps correctly adjusting to local time when reading them back
//
out. So lets disallow it here
.
//
On 32-bit systems
th
e
time
_t is implemented as the int32_t value.
//
We want to detect overfl
ows b
eyond maximum int32_t value here
// to
avoid the overflow in the PostgreSQL database. The PostgreSQL
//
doesn't catch those overflows on its own
.
if
(
expire_time_64
>
LeaseMgr
::
MAX_DB_TIME
)
{
isc_throw
(
isc
::
BadValue
,
"Time value is too large: "
<<
expire_time_64
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment