aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/plugins/sql/sql_attribute.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2008-05-15 09:26:47 +0000
committerMartin Willi <martin@strongswan.org>2008-05-15 09:26:47 +0000
commit89658f6d6c0cea83f62109ad15f93df89873e499 (patch)
tree2e411f8ef6a33872a3c3961886a19c9678313c49 /src/charon/plugins/sql/sql_attribute.c
parentbb94e1ed601ae3c256c882c8f1fb34525b401577 (diff)
downloadstrongswan-89658f6d6c0cea83f62109ad15f93df89873e499.tar.bz2
strongswan-89658f6d6c0cea83f62109ad15f93df89873e499.tar.xz
static leases use 0, not NULL timeout
fixed static leases
Diffstat (limited to 'src/charon/plugins/sql/sql_attribute.c')
-rw-r--r--src/charon/plugins/sql/sql_attribute.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/charon/plugins/sql/sql_attribute.c b/src/charon/plugins/sql/sql_attribute.c
index 2007d94ab..c5a9e05f1 100644
--- a/src/charon/plugins/sql/sql_attribute.c
+++ b/src/charon/plugins/sql/sql_attribute.c
@@ -95,7 +95,7 @@ static host_t* get_lease(private_sql_attribute_t *this,
"JOIN pools AS p ON l.pool = p.id "
"JOIN identities AS i ON l.identity = i.id "
"WHERE p.name = ? AND i.type = ? AND i.data = ? "
- "AND (l.released IS NULL OR p.timeout IS NULL "
+ "AND (l.released IS NULL OR p.timeout = 0 "
" OR (l.released >= (? - p.timeout))) "
"ORDER BY l.acquired LIMIT 1", DB_TEXT, name,
DB_INT, id->get_type(id), DB_BLOB, id->get_encoding(id),
@@ -146,7 +146,7 @@ static host_t* create_lease(private_sql_attribute_t *this,
e = this->db->query(this->db,
"SELECT pool, address, released, timeout FROM leases "
"JOIN pools ON leases.pool = pools.id "
- "WHERE name = ? "
+ "WHERE name = ? and timeout > 0 "
"GROUP BY address HAVING COUNT(released) = COUNT(*) "
"AND MAX(released) < (? - timeout) LIMIT 1",
DB_TEXT, name, DB_UINT, time(NULL),