aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2010-03-10 10:46:49 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2010-03-10 10:46:49 +0100
commitd12ad4748a01cd17834e32081d3893bd97eef2b2 (patch)
tree8cf96c8d09ade6de1ac2d2dfb245ad9228435b39
parenta5166b16a1f1ad1759bba1485bf503da22206835 (diff)
downloadstrongswan-d12ad4748a01cd17834e32081d3893bd97eef2b2.tar.bz2
strongswan-d12ad4748a01cd17834e32081d3893bd97eef2b2.tar.xz
fix 64bit issue with time_t from database
-rw-r--r--src/libstrongswan/plugins/attr_sql/pool.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libstrongswan/plugins/attr_sql/pool.c b/src/libstrongswan/plugins/attr_sql/pool.c
index 85b30a70f..a901b6741 100644
--- a/src/libstrongswan/plugins/attr_sql/pool.c
+++ b/src/libstrongswan/plugins/attr_sql/pool.c
@@ -748,7 +748,8 @@ static void leases(char *filter, bool utc)
chunk_t address_chunk, identity_chunk;
int identity_type;
char *name;
- u_int acquired, released, timeout;
+ u_int db_acquired, db_released, db_timeout;
+ time_t acquired, released, timeout;
host_t *address;
identification_t *identity;
bool found = FALSE;
@@ -760,7 +761,7 @@ static void leases(char *filter, bool utc)
exit(-1);
}
while (query->enumerate(query, &name, &address_chunk, &identity_type,
- &identity_chunk, &acquired, &released, &timeout))
+ &identity_chunk, &db_acquired, &db_released, &db_timeout))
{
if (!found)
{
@@ -773,6 +774,11 @@ static void leases(char *filter, bool utc)
address = host_create_from_chunk(AF_UNSPEC, address_chunk, 0);
identity = identification_create_from_encoding(identity_type, identity_chunk);
+ /* u_int is not always equal to time_t */
+ acquired = (time_t)db_acquired;
+ released = (time_t)db_released;
+ timeout = (time_t)db_timeout;
+
printf("%-8s %-15H ", name, address);
if (released == 0)
{