From: Nick Porter Date: Thu, 18 Jan 2024 17:43:36 +0000 (+0000) Subject: Ensure IP updated is from the correct pool X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d95e44e13b1208e98d429b1aa6c0f86df65239e8;p=thirdparty%2Ffreeradius-server.git Ensure IP updated is from the correct pool In case IPs exist in more than one pool. --- diff --git a/raddb/mods-config/sql/ippool/mssql/queries.conf b/raddb/mods-config/sql/ippool/mssql/queries.conf index 0a8cd64742e..d8a8dd8aa08 100644 --- a/raddb/mods-config/sql/ippool/mssql/queries.conf +++ b/raddb/mods-config/sql/ippool/mssql/queries.conf @@ -156,7 +156,8 @@ pool_check = "\ # SET \ # gateway = '${gateway}', owner = '${owner}', \ # expiry_time = DATEADD(SECOND,${offer_duration},CURRENT_TIMESTAMP) \ -# WHERE address = '%{reply.${allocated_address_attr}}'" +# WHERE address = '%{reply.${allocated_address_attr}}' \ +# AND pool_name = '%{control.${pool_name}}'" # # Use a stored procedure to find AND allocate the address. Read and customise diff --git a/raddb/mods-config/sql/ippool/mysql/queries.conf b/raddb/mods-config/sql/ippool/mysql/queries.conf index dbed130d3e1..929d38cd66c 100644 --- a/raddb/mods-config/sql/ippool/mysql/queries.conf +++ b/raddb/mods-config/sql/ippool/mysql/queries.conf @@ -119,7 +119,8 @@ alloc_update = "\ SET \ gateway = '${gateway}', owner = '${owner}', \ expiry_time = NOW() + INTERVAL ${offer_duration} SECOND \ - WHERE address = '%{reply.${allocated_address_attr}}'" + WHERE address = '%{reply.${allocated_address_attr}}' \ + AND pool_name = '%{control.${pool_name}}'" # # Use a stored procedure to find AND allocate the address. Read and customise diff --git a/raddb/mods-config/sql/ippool/oracle/queries.conf b/raddb/mods-config/sql/ippool/oracle/queries.conf index c4b2e919992..b93ef5a4965 100644 --- a/raddb/mods-config/sql/ippool/oracle/queries.conf +++ b/raddb/mods-config/sql/ippool/oracle/queries.conf @@ -108,7 +108,8 @@ pool_check = "\ # gateway = '${gateway}', \ # owner = '${owner}', \ # expiry_time = current_timestamp + INTERVAL '${offer_duration}' second(1) \ -# WHERE address = '%{reply.${allocated_address_attr}}'" +# WHERE address = '%{reply.${allocated_address_attr}}' \ +# AND pool_name = '%{control.${pool_name}}'" # diff --git a/raddb/mods-config/sql/ippool/postgresql/queries.conf b/raddb/mods-config/sql/ippool/postgresql/queries.conf index 19f4da6f3f6..bb33b7b97f8 100644 --- a/raddb/mods-config/sql/ippool/postgresql/queries.conf +++ b/raddb/mods-config/sql/ippool/postgresql/queries.conf @@ -112,7 +112,8 @@ alloc_find = "\ # gateway = '${gateway}', \ # owner = '${owner}', \ # expiry_time = 'now'::timestamp(0) + '${offer_duration} second'::interval \ -# WHERE address = '%{reply.${allocated_address_attr}}'" +# WHERE address = '%{reply.${allocated_address_attr}}' \ +# AND pool_name = '%{control.${pool_name}}'" # # If the SELECT and UPDATE are in separate queries then set the following diff --git a/raddb/mods-config/sql/ippool/sqlite/queries.conf b/raddb/mods-config/sql/ippool/sqlite/queries.conf index cb4bb1c6262..df7384e449b 100644 --- a/raddb/mods-config/sql/ippool/sqlite/queries.conf +++ b/raddb/mods-config/sql/ippool/sqlite/queries.conf @@ -104,7 +104,8 @@ alloc_update = "\ gateway = '${gateway}', \ owner = '${owner}', \ expiry_time = datetime(strftime('%%s', 'now') + ${offer_duration}, 'unixepoch') \ - WHERE address = '%{reply.${allocated_address_attr}}'" + WHERE address = '%{reply.${allocated_address_attr}}' \ + AND pool_name = '%{control.${pool_name}}'" #