]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
the expiry time should NOT be NULL
authorAlan T. DeKok <aland@freeradius.org>
Sat, 12 Jan 2019 15:35:09 +0000 (10:35 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 21 Jan 2019 22:24:35 +0000 (17:24 -0500)
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.

raddb/mods-config/sql/ippool/mysql/queries.conf
raddb/mods-config/sql/ippool/mysql/schema.sql

index 73aad87d733fbda502f46042128ee393f9e2d9cf..8611721c5a4bbcec312f0483d24d5f506fd58fe7 100644 (file)
@@ -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}'"
index ffacc44c87bdc99fb1986dc99549f7331d139387..3480ca9cf1fb27eb4f9751e0878c8ccefa02d9a3 100644 (file)
@@ -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),