From: Alan T. DeKok Date: Sat, 12 Jan 2019 15:35:09 +0000 (-0500) Subject: the expiry time should NOT be NULL X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af8b735c905dddef813f2bdb1eefcb09cd0b4f53;p=thirdparty%2Ffreeradius-server.git the expiry time should NOT be NULL change the schema to set a default value of zero. Change the queries to set it to 0 on clear. Leave the allocate_find with checking for NULL, as people might have old schemas around. --- diff --git a/raddb/mods-config/sql/ippool/mysql/queries.conf b/raddb/mods-config/sql/ippool/mysql/queries.conf index 73aad87d733..8611721c5a4 100644 --- a/raddb/mods-config/sql/ippool/mysql/queries.conf +++ b/raddb/mods-config/sql/ippool/mysql/queries.conf @@ -54,7 +54,7 @@ # pool_key = 0, \ # callingstationid = '', \ # username = '', \ -# expiry_time = NULL \ +# expiry_time = 0 \ # WHERE pool_key = '${pool_key}'" # @@ -69,7 +69,7 @@ allocate_clear = "\ pool_key = 0, \ callingstationid = '', \ username = '', \ - expiry_time = NULL \ + expiry_time = 0 \ WHERE expiry_time <= NOW() - INTERVAL 1 SECOND \ AND nasipaddress = '%{Nas-IP-Address}'" @@ -104,7 +104,7 @@ allocate_find = "\ #allocate_find = "\ # SELECT framedipaddress FROM ${ippool_table} \ # WHERE pool_name = '%{control:Pool-Name}' \ -# AND expiry_time IS NULL \ +# AND expiry_time IS 0 \ # ORDER BY \ # RAND() \ # LIMIT 1 \ @@ -166,7 +166,7 @@ start_update = "\ # stop_clear = "\ # UPDATE ${ippool_table} \ # SET \ -# expiry_time = NULL \ +# expiry_time = 0 \ # WHERE nasipaddress = '%{Nas-IP-Address}' \ # AND pool_key = '${pool_key}' \ # AND username = '%{User-Name}' \ @@ -180,7 +180,7 @@ stop_clear = "\ pool_key = 0, \ callingstationid = '', \ username = '', \ - expiry_time = NULL \ + expiry_time = 0 \ WHERE nasipaddress = '%{Nas-IP-Address}' \ AND pool_key = '${pool_key}' \ AND username = '%{User-Name}' \ @@ -214,7 +214,7 @@ on_clear = "\ pool_key = 0, \ callingstationid = '', \ username = '', \ - expiry_time = NULL \ + expiry_time = 0 \ WHERE nasipaddress = '%{Nas-IP-Address}'" # @@ -230,5 +230,5 @@ off_clear = "\ pool_key = 0, \ callingstationid = '', \ username = '', \ - expiry_time = NULL \ + expiry_time = 0 \ WHERE nasipaddress = '%{Nas-IP-Address}'" diff --git a/raddb/mods-config/sql/ippool/mysql/schema.sql b/raddb/mods-config/sql/ippool/mysql/schema.sql index ffacc44c87b..3480ca9cf1f 100644 --- a/raddb/mods-config/sql/ippool/mysql/schema.sql +++ b/raddb/mods-config/sql/ippool/mysql/schema.sql @@ -8,7 +8,7 @@ CREATE TABLE radippool ( nasipaddress varchar(15) NOT NULL default '', calledstationid VARCHAR(30) NOT NULL, callingstationid VARCHAR(30) NOT NULL, - expiry_time DATETIME NULL default NULL, + expiry_time DATETIME NOT NULL default 0, username varchar(64) NOT NULL default '', pool_key varchar(30) NOT NULL, PRIMARY KEY (id),