From f3bcd7f04168b6e9da55c6598d1145b6806ede09 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Fri, 9 May 2008 12:22:20 +0000 Subject: correctly reassigning valid leases --- src/charon/plugins/sql/sql_attribute.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/charon/plugins/sql/sql_attribute.c') diff --git a/src/charon/plugins/sql/sql_attribute.c b/src/charon/plugins/sql/sql_attribute.c index 2032b420f..717d8fe59 100644 --- a/src/charon/plugins/sql/sql_attribute.c +++ b/src/charon/plugins/sql/sql_attribute.c @@ -96,9 +96,10 @@ static host_t* get_lease(private_sql_attribute_t *this, "JOIN identities AS i ON l.identity = i.id " "WHERE p.name = ? AND i.type = ? AND i.data = ? " "AND (l.release ISNULL OR p.timeout ISNULL " - " OR (l.release < (p.timeout + l.acquire))) " + " OR (l.release >= (? - p.timeout))) " "ORDER BY l.acquire LIMIT 1", DB_TEXT, name, DB_INT, id->get_type(id), DB_BLOB, id->get_encoding(id), + DB_UINT, time(NULL), DB_INT, DB_BLOB); if (e) { -- cgit v1.2.3