]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: remove autoserial
authorKees Monshouwer <mind04@monshouwer.org>
Tue, 7 Aug 2018 10:20:39 +0000 (12:20 +0200)
committermind04 <mind04@monshouwer.org>
Tue, 6 Nov 2018 23:19:42 +0000 (00:19 +0100)
48 files changed:
docs/backends/generic-mysql.rst
docs/backends/generic-odbc.rst
docs/backends/generic-oracle.rst
docs/backends/generic-postgresql.rst
docs/backends/generic-sql.rst
docs/backends/oracle.rst
modules/gmysqlbackend/4.1.0_to_5.0.0_schema.mysql.sql [moved from modules/gmysqlbackend/4.1.0_to_4.1.1_schema.mysql.sql with 60% similarity]
modules/gmysqlbackend/Makefile.am
modules/gmysqlbackend/gmysqlbackend.cc
modules/gmysqlbackend/schema.mysql.sql
modules/godbcbackend/4.0.0_to_5.0.0_schema.mssql.sql [new file with mode: 0644]
modules/godbcbackend/Makefile.am
modules/godbcbackend/godbcbackend.cc
modules/godbcbackend/schema.mssql.sql
modules/goraclebackend/goraclebackend.cc
modules/goraclebackend/schema.goracle.sql
modules/gpgsqlbackend/4.1.0_to_5.0.0_schema.pgsql.sql [new file with mode: 0644]
modules/gpgsqlbackend/Makefile.am
modules/gpgsqlbackend/gpgsqlbackend.cc
modules/gpgsqlbackend/schema.pgsql.sql
modules/gsqlite3backend/3.4.0_to_4.0.0_schema.sqlite3.sql [moved from modules/gsqlite3backend/enable_foreign_keys.sql with 100% similarity]
modules/gsqlite3backend/4.0.0_to_5.0.0_schema.sqlite3.sql [new file with mode: 0644]
modules/gsqlite3backend/Makefile.am
modules/gsqlite3backend/gsqlite3backend.cc
modules/gsqlite3backend/schema.sqlite3.sql
modules/luabackend/luabackend.hh
modules/luabackend/minimal.cc
modules/mydnsbackend/mydnsbackend.cc
modules/mydnsbackend/mydnsbackend.hh
modules/opendbxbackend/odbxbackend.cc
modules/opendbxbackend/odbxbackend.hh
modules/oraclebackend/oraclebackend.cc
modules/oraclebackend/schema.oracle.sql
modules/remotebackend/httpconnector.cc
modules/remotebackend/regression-tests/test-schema.sql
modules/remotebackend/remotebackend.cc
modules/remotebackend/remotebackend.hh
modules/remotebackend/test-remotebackend.cc
modules/remotebackend/unittest.rb
pdns/backends/gsql/gsqlbackend.cc
pdns/backends/gsql/gsqlbackend.hh
pdns/dnsbackend.cc
pdns/dnsbackend.hh
pdns/rfc2136handler.cc
pdns/ueberbackend.cc
pdns/ueberbackend.hh
pdns/ws-auth.cc
regression-tests/backends/godbc_sqlite3-master

index 9f8cef76dbd249bbed24261b960eabe784b310b1..6247f9202db24c36f481774284bee60fad34f985 100644 (file)
@@ -5,7 +5,7 @@ Generic MySQL backend
 * Master: Yes
 * Slave: Yes
 * Superslave: Yes
-* Autoserial: Yes
+* Autoserial: No
 * Case: All lower
 * DNSSEC: Yes (set ``gmysql-dnssec``)
 * Disabled data: Yes
index 150d43f7e870c81078b5139488156d4ca7bf07f9..65d42325328e53937774c15fcf7699cb93ce800f 100644 (file)
@@ -5,7 +5,7 @@ Generic ODBC Backend
 * Master: Yes
 * Slave: Yes
 * Superslave: Yes
-* Autoserial: Yes
+* Autoserial: No
 * Case: All lower
 * DNSSEC: Yes
 * Disabled data: Yes
index e2f1febbb39d71d687ea4979c0ba5ed322c834ad..f7401b32ac68bb7d3178a1b3533b0374af799b5e 100644 (file)
@@ -5,7 +5,7 @@ Generic Oracle backend
 * Master: Yes
 * Slave: Yes
 * Superslave: Yes
-* Autoserial: Yes
+* Autoserial: No
 * Case: All lower
 * DNSSEC: Yes (set ``goracle-dnssec``)
 * Disabled data: Yes
index 0243a41277f23fc64170d38013e48cac946e38b3..3bb34ddb2d523cedb11339ecf9cf0a207392d630 100644 (file)
@@ -5,7 +5,7 @@ Generic PostgreSQL backend
 * Master: Yes
 * Slave: Yes
 * Superslave: Yes
-* Autoserial: Yes
+* Autoserial: No
 * Case: All lower
 * DNSSEC: Yes (set ``gpgsql-dnssec``)
 * Disabled data: Yes
index e1c8523a59ac61c6091b1aabd7221e56a1b3622b..b1e2027f117924351c5b0549b7e42c3d45b4165a 100644 (file)
@@ -124,17 +124,6 @@ domain is disabled, slaving still works. Slaving considers a disabled
 domain to have a serial of 0; this implies that a slaved domain will not
 stay disabled.
 
-.. _autoserial:
-
-Autoserial
-^^^^^^^^^^
-
-The autoserial functionality makes PowerDNS generate the SOA serial when
-the SOA serial set to ``0`` in the database. The serial in SOA responses
-is set to what's provided by ``zone-lastchange-query``. By default, this
-is the highest value of the ``change_date`` field in the "records"
-table).
-
 .. _generic-sql-handling-dnssec-signed-zones:
 
 Handling DNSSEC signed zones
@@ -333,8 +322,6 @@ On masters
    which the server is master.
 -  ``update-serial-query`` Called to update the last notified serial of
    a master domain.
--  ``zone-lastchange-query``: Called to determine the last change to a
-   zone, used for autoserial.
 
 On slaves
 ~~~~~~~~~
index 75f69d3f24e1b2f6e36358d4f4572ecabd346bc9..64ad6c60fe7817dad46c387562fe43b67f9254f0 100644 (file)
@@ -5,7 +5,7 @@ Oracle backend
 * Master: Yes
 * Slave: Yes
 * Superslave: Yes
-* Autoserial: Yes
+* Autoserial: No
 * DNSSEC: Yes
 * Comments: No
 * Module name: oracle
@@ -301,13 +301,6 @@ The data part of the DNS record, in canonical string representation,
 except that if this includes FQDNs, they should be specified without a
 trailing dot.
 
-last\_change
-^^^^^^^^^^^^
-
-The unix timestamp of the last change to this record. Used only for the
-deprecated autoserial feature. You can omit this unless you want to use
-that feature.
-
 auth
 ^^^^
 
@@ -338,9 +331,6 @@ columns:
 -  zone\_id: The numerical identifier of the zone the record belongs to.
    A record can belong to two zones (delegations/glue), in which case it
    may be returned twice.
--  last\_change: The unix timestamp of the last time this record was
-   changed. Can safely be set as a constant 0, unless you use the
-   autoserial feature.
 -  auth: 1 or 0 depending on the zone membership (authoritative or not).
 
 Record sets (records for the same name of the same type) must appear
similarity index 60%
rename from modules/gmysqlbackend/4.1.0_to_4.1.1_schema.mysql.sql
rename to modules/gmysqlbackend/4.1.0_to_5.0.0_schema.mysql.sql
index 6745c636bc26b6eaa6566bc8732f3e96c62f772c..01efae925dda84329ead88694c02e677ce460faa 100644 (file)
@@ -1 +1,3 @@
 ALTER TABLE domains MODIFY notified_serial INT UNSIGNED DEFAULT NULL;
+
+ALTER TABLE records DROP COLUMN change_date;
index aea6142cd7526ba2e19d08441f6025e80689e885..db2c5ca5dbb5ef5123429b7c01ce5a041222610b 100644 (file)
@@ -13,7 +13,7 @@ dist_doc_DATA = \
        dnssec-3.x_to_3.4.0_schema.mysql.sql \
        nodnssec-3.x_to_3.4.0_schema.mysql.sql \
        3.4.0_to_4.1.0_schema.mysql.sql \
-       4.1.0_to_4.1.1_schema.mysql.sql \
+       4.1.0_to_5.0.0_schema.mysql.sql \
        schema.mysql.sql
 
 libgmysqlbackend_la_SOURCES = \
index 1d0bed64d5b59505bb855c5b73b56d0215b5fe54..e3033abe3b1a7a2a68b5ca93b01b17cf4b45451c 100644 (file)
@@ -102,8 +102,8 @@ public:
 
     declare(suffix,"insert-zone-query","", "insert into domains (type,name,master,account,last_check,notified_serial) values(?,?,?,?,NULL,NULL)");
 
-    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth,change_date) values (?,?,?,?,?,?,?,?,?,NULL)");
-    declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth,change_date,content,ttl,prio) values (null,?,0,?,?,?,NULL,NULL,NULL,NULL)");
+    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (?,?,?,?,?,?,?,?,?)");
+    declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth,content,ttl,prio) values (null,?,0,?,?,?,NULL,NULL,NULL)");
 
     declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, first", "select ordername from records where domain_id=? and disabled=0 and ordername is not null order by 1 asc limit 1");
     declare(suffix, "get-order-before-query", "DNSSEC Ordering Query, before", "select ordername, name from records where ordername <= ? and domain_id=? and disabled=0 and ordername is not null order by 1 desc limit 1");
@@ -120,7 +120,6 @@ public:
     declare(suffix,"update-account-query","", "update domains set account=? where name=?");
     declare(suffix,"update-serial-query","", "update domains set notified_serial=? where id=?");
     declare(suffix,"update-lastcheck-query","", "update domains set last_check=? where id=?");
-    declare(suffix,"zone-lastchange-query", "", "select max(change_date) from records where domain_id=?");
     declare(suffix,"info-all-master-query","", "select id,name,master,last_check,notified_serial,type from domains where type='MASTER'");
     declare(suffix,"delete-domain-query","", "delete from domains where name=?");
     declare(suffix,"delete-zone-query","", "delete from records where domain_id=?");
index 1c6eee5a5b4e8dd09d0b5dc71e7d78d01c4039a0..2dea1c24cc72ec5d33854fa27d3634f7b21eb0d9 100644 (file)
@@ -20,7 +20,6 @@ CREATE TABLE records (
   content               VARCHAR(64000) DEFAULT NULL,
   ttl                   INT DEFAULT NULL,
   prio                  INT DEFAULT NULL,
-  change_date           INT DEFAULT NULL,
   disabled              TINYINT(1) DEFAULT 0,
   ordername             VARCHAR(255) BINARY DEFAULT NULL,
   auth                  TINYINT(1) DEFAULT 1,
diff --git a/modules/godbcbackend/4.0.0_to_5.0.0_schema.mssql.sql b/modules/godbcbackend/4.0.0_to_5.0.0_schema.mssql.sql
new file mode 100644 (file)
index 0000000..f910462
--- /dev/null
@@ -0,0 +1 @@
+ALTER TABLE records DROP COLUMN change_date;
index 199b848739326acf36299075e092fddd89d7552c..ce1c0af4cabf27541fcce643bc20a0605be30306 100644 (file)
@@ -3,7 +3,8 @@ pkglib_LTLIBRARIES = libgodbcbackend.la
 
 EXTRA_DIST=OBJECTFILES OBJECTLIBS
 
-dist_doc_DATA=schema.mssql.sql
+dist_doc_DATA=schema.mssql.sql \
+       4.0.0_to_5.0.0_schema.mssql.sql
 
 libgodbcbackend_la_SOURCES=godbcbackend.cc godbcbackend.hh \
                 sodbc.hh sodbc.cc
index 9db1f5ff79b6e2837be7f05bc5ac95df9247b5c7..7334df4c9d5e0c71a7d7de21ad19978ea1e4965e 100644 (file)
@@ -89,8 +89,8 @@ public:
 
     declare(suffix,"insert-zone-query","", "insert into domains (type,name,master,account,last_check,notified_serial) values(?,?,?,?,null,null)");
 
-    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth,change_date) values (?,?,?,?,?,?,?,convert(varbinary(255),?),?,null)");
-    declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth,ttl,prio,change_date,content) values (null,?,0,?,convert(varbinary(255),?),?,null,null,null,null)");
+    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (?,?,?,?,?,?,?,convert(varbinary(255),?),?)");
+    declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth,ttl,prio,content) values (null,?,0,?,convert(varbinary(255),?),?,null,null,null)");
 
     declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, first", "select top 1 convert(varchar(255), ordername) from records where domain_id=? and disabled=0 and ordername is not null order by 1 asc");
     declare(suffix, "get-order-before-query", "DNSSEC Ordering Query, before", "select top 1 convert(varchar(255), ordername), name from records where ordername <= convert(varbinary(255),?) and domain_id=? and disabled=0 and ordername is not null order by 1 desc");
@@ -107,7 +107,6 @@ public:
     declare(suffix,"update-account-query","", "update domains set account=? where name=?");
     declare(suffix,"update-serial-query","", "update domains set notified_serial=? where id=?");
     declare(suffix,"update-lastcheck-query","", "update domains set last_check=? where id=?");
-    declare(suffix,"zone-lastchange-query", "", "select max(change_date) from records where domain_id=?");
     declare(suffix,"info-all-master-query","", "select id,name,master,last_check,notified_serial,type from domains where type='MASTER'");
     declare(suffix,"delete-domain-query","", "delete from domains where name=?");
     declare(suffix,"delete-zone-query","", "delete from records where domain_id=?");
index 7a4c235dad61e7e8a140bcde468851907fe6f2e1..0bd56a012eb40a75a515dc39e610439499b44e56 100644 (file)
@@ -19,7 +19,6 @@ CREATE TABLE records (
   content               VARCHAR(MAX) DEFAULT NULL,
   ttl                   INT DEFAULT NULL,
   prio                  INT DEFAULT NULL,
-  change_date           INT DEFAULT NULL,
   disabled              BIT DEFAULT 0,
   ordername             VARBINARY(255) DEFAULT NULL,
   auth                  BIT DEFAULT 1,
index 6a5d3e756efb0f853f9861939317fda4358159f6..f18c47630792985d85e0be5f647089a4bce6fb13 100644 (file)
@@ -106,8 +106,8 @@ public:
     declare(suffix, "supermaster-query", "", "select account from supermasters where ip=:ip and nameserver=:nameserver");
     declare(suffix, "supermaster-name-to-ips", "", "select ip,account from supermasters where nameserver=:nameserver and account=:account");
     declare(suffix, "insert-zone-query", "", "insert into domains (id,type,name,master,account,last_check_notified_serial) values(domains_id_sequence.nextval,:type,:domain,:masters,:account, null, null)");
-    declare(suffix, "insert-record-query", "", "insert into records (id,content,ttl,prio,type,domain_id,disabled,name,ordername,auth,change_date) values (records_id_sequence.nextval,:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:ordername || ' ',:auth, null)");
-    declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (id,type,domain_id,disabled,name,ordername,auth,ttl,prio,change_date,content) values (records_id_sequence.nextval,null,:domain_id,0,:qname,:ordername,:auth,null,null,null,null)");
+    declare(suffix, "insert-record-query", "", "insert into records (id,content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (records_id_sequence.nextval,:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:ordername || ' ',:auth)");
+    declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (id,type,domain_id,disabled,name,ordername,auth,ttl,prio,content) values (records_id_sequence.nextval,null,:domain_id,0,:qname,:ordername,:auth,null,null,null)");
 
     declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, first", "select * FROM (select trim(ordername) from records where disabled=0 and domain_id=:domain_id and ordername is not null order by ordername asc) where rownum=1");
     declare(suffix, "get-order-before-query", "DNSSEC Ordering Query, before", "select * FROM (select trim(ordername), name from records where disabled=0 and ordername <= :ordername || ' ' and domain_id=:domain_id and ordername is not null order by ordername desc) where rownum=1");
@@ -124,7 +124,6 @@ public:
     declare(suffix, "update-account-query", "", "update domains set account=:account where name=:domain");
     declare(suffix, "update-serial-query", "", "update domains set notified_serial=:serial where id=:domain_id");
     declare(suffix, "update-lastcheck-query", "", "update domains set last_check=:last_check where id=:domain_id");
-    declare(suffix, "zone-lastchange-query", "", "select max(change_date) from records where domain_id=:domain_id");
     declare(suffix, "info-all-master-query", "", "select id,name,master,last_check,notified_serial,type from domains where type='MASTER'");
     declare(suffix, "delete-domain-query","", "delete from domains where name=:domain");
     declare(suffix, "delete-zone-query", "", "delete from records where domain_id=:domain_id");
index f15fb93a2c9a07416e7d389e1b90e1d9526ef082..c2f9016db1fa91718e58b66a4e95d97fd784a155 100644 (file)
@@ -21,7 +21,6 @@ CREATE TABLE records (
   content         VARCHAR2(4000) DEFAULT NULL,
   ttl             INTEGER DEFAULT NULL,
   prio            INTEGER DEFAULT NULL,
-  change_date     INTEGER DEFAULT NULL,
   disabled        NUMBER(1,0) DEFAULT 0 NOT NULL,
   ordername       VARCHAR2(255) DEFAULT NULL,
   auth            NUMBER(1,0) DEFAULT 1 NOT NULL,
diff --git a/modules/gpgsqlbackend/4.1.0_to_5.0.0_schema.pgsql.sql b/modules/gpgsqlbackend/4.1.0_to_5.0.0_schema.pgsql.sql
new file mode 100644 (file)
index 0000000..f910462
--- /dev/null
@@ -0,0 +1 @@
+ALTER TABLE records DROP COLUMN change_date;
index 8a820d516bbc0f828c85f372962628cd2673783e..86818fa0df49698f43531e0e9fdd595bcf89a3c0 100644 (file)
@@ -12,7 +12,8 @@ dist_doc_DATA = \
        schema.pgsql.sql \
        nodnssec-3.x_to_3.4.0_schema.pgsql.sql \
        dnssec-3.x_to_3.4.0_schema.pgsql.sql \
-       3.4.0_to_4.1.0_schema.pgsql.sql
+       3.4.0_to_4.1.0_schema.pgsql.sql \
+       4.1.0_to_5.0.0_schema.pgsql.sql
 
 libgpgsqlbackend_la_SOURCES = \
        gpgsqlbackend.cc gpgsqlbackend.hh \
index 5e108e978f8392eae7845ea3d6f50ec1796d8293..641f74bb1b6498add1c3e650ae8f893df89afa95 100644 (file)
@@ -111,8 +111,8 @@ public:
 
     declare(suffix,"insert-zone-query","", "insert into domains (type,name,master,account,last_check, notified_serial) values($1,$2,$3,$4,null,null)");
 
-    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth,change_date) values ($1,$2,$3,$4,$5,$6,$7,$8,$9,null)");
-    declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth,ttl,prio,change_date,content) values (null,$1,false,$2,$3,$4,null,null,null,null)");
+    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values ($1,$2,$3,$4,$5,$6,$7,$8,$9)");
+    declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth,ttl,prio,content) values (null,$1,false,$2,$3,$4,null,null,null)");
 
     declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, last", "select ordername from records where disabled=false and domain_id=$1 and ordername is not null order by 1 using ~<~ limit 1");
     declare(suffix, "get-order-before-query", "DNSSEC Ordering Query, before", "select ordername, name from records where disabled=false and ordername ~<=~ $1 and domain_id=$2 and ordername is not null order by 1 using ~>~ limit 1");
@@ -129,7 +129,6 @@ public:
     declare(suffix,"update-account-query","", "update domains set account=$1 where name=$2");
     declare(suffix,"update-serial-query","", "update domains set notified_serial=$1 where id=$2");
     declare(suffix,"update-lastcheck-query","", "update domains set last_check=$1 where id=$2");
-    declare(suffix,"zone-lastchange-query", "", "select max(change_date) from records where domain_id=$1");
     declare(suffix,"info-all-master-query","", "select id,name,master,last_check,notified_serial,type from domains where type='MASTER'");
     declare(suffix,"delete-domain-query","", "delete from domains where name=$1");
     declare(suffix,"delete-zone-query","", "delete from records where domain_id=$1");
index b105d879515488fe7f29c96f14f876abe7810e8b..e6c6b7c3bc9fc5809c68bb03f8caaf368bb0a353 100644 (file)
@@ -20,7 +20,6 @@ CREATE TABLE records (
   content               VARCHAR(65535) DEFAULT NULL,
   ttl                   INT DEFAULT NULL,
   prio                  INT DEFAULT NULL,
-  change_date           INT DEFAULT NULL,
   disabled              BOOL DEFAULT 'f',
   ordername             VARCHAR(255),
   auth                  BOOL DEFAULT 't',
diff --git a/modules/gsqlite3backend/4.0.0_to_5.0.0_schema.sqlite3.sql b/modules/gsqlite3backend/4.0.0_to_5.0.0_schema.sqlite3.sql
new file mode 100644 (file)
index 0000000..47c39ad
--- /dev/null
@@ -0,0 +1,39 @@
+BEGIN TRANSACTION;
+    CREATE TEMPORARY TABLE records_backup (
+      id                    INTEGER PRIMARY KEY,
+      domain_id             INTEGER DEFAULT NULL,
+      name                  VARCHAR(255) DEFAULT NULL,
+      type                  VARCHAR(10) DEFAULT NULL,
+      content               VARCHAR(65535) DEFAULT NULL,
+      ttl                   INTEGER DEFAULT NULL,
+      prio                  INTEGER DEFAULT NULL,
+      disabled              BOOLEAN DEFAULT 0,
+      ordername             VARCHAR(255),
+      auth                  BOOL DEFAULT 1
+    );
+
+    INSERT INTO records_backup SELECT id,domain_id,name,type,content,ttl,prio,disabled,ordername,auth FROM records;
+    DROP TABLE records;
+
+    CREATE TABLE records (
+      id                    INTEGER PRIMARY KEY,
+      domain_id             INTEGER DEFAULT NULL,
+      name                  VARCHAR(255) DEFAULT NULL,
+      type                  VARCHAR(10) DEFAULT NULL,
+      content               VARCHAR(65535) DEFAULT NULL,
+      ttl                   INTEGER DEFAULT NULL,
+      prio                  INTEGER DEFAULT NULL,
+      disabled              BOOLEAN DEFAULT 0,
+      ordername             VARCHAR(255),
+      auth                  BOOL DEFAULT 1,
+      FOREIGN KEY(domain_id) REFERENCES domains(id) ON DELETE CASCADE ON UPDATE CASCADE
+    );
+
+    CREATE INDEX rec_name_index ON records(name);
+    CREATE INDEX nametype_index ON records(name,type);
+    CREATE INDEX domain_id ON records(domain_id);
+    CREATE INDEX orderindex ON records(ordername);
+
+    INSERT INTO records SELECT id,domain_id,name,type,content,ttl,prio,disabled,ordername,auth FROM records_backup;
+    DROP TABLE records_backup;
+COMMIT;
index c4566d5552ac4d42e255ffc7b42e2a42940df169..1580f597644ac77d823ccb9d1bf9cf51bfbb75a6 100644 (file)
@@ -10,6 +10,8 @@ EXTRA_DIST = \
 dist_doc_DATA = \
        dnssec-3.x_to_3.4.0_schema.sqlite3.sql \
        nodnssec-3.x_to_3.4.0_schema.sqlite3.sql \
+       3.4.0_to_4.0.0_schema.sqlite3.sql \
+       4.0.0_to_5.0.0_schema.sqlite3.sql \
        schema.sqlite3.sql
 
 libgsqlite3backend_la_SOURCES = gsqlite3backend.cc gsqlite3backend.hh
index 9bda9572ffd3d000088a0cccf98e7839e3160e36..f9cb892fcbf911ed48c5de947edbef65b755a8cf 100644 (file)
@@ -101,8 +101,8 @@ public:
 
     declare(suffix, "insert-zone-query", "", "insert into domains (type,name,master,account,last_check,notified_serial) values(:type, :domain, :masters, :account, null, null)");
 
-    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth,change_date) values (:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:ordername,:auth,null)");
-    declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth,ttl,prio,change_date,content) values (null,:domain_id,0,:qname,:ordername,:auth,null,null,null,null)");
+    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:ordername,:auth)");
+    declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth,ttl,prio,content) values (null,:domain_id,0,:qname,:ordername,:auth,null,null,null)");
 
     declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, first", "select ordername from records where disabled=0 and domain_id=:domain_id and ordername is not null order by 1 asc limit 1");
     declare(suffix, "get-order-before-query", "DNSSEC Ordering Query, before", "select ordername, name from records where disabled=0 and ordername <= :ordername and domain_id=:domain_id and ordername is not null order by 1 desc limit 1");
@@ -119,7 +119,6 @@ public:
     declare(suffix, "update-account-query","", "update domains set account=:account where name=:domain");
     declare(suffix, "update-serial-query", "", "update domains set notified_serial=:serial where id=:domain_id");
     declare(suffix, "update-lastcheck-query", "", "update domains set last_check=:last_check where id=:domain_id");
-    declare(suffix, "zone-lastchange-query", "", "select max(change_date) from records where domain_id=:domain_id");
     declare(suffix, "info-all-master-query", "", "select id,name,master,last_check,notified_serial,type from domains where type='MASTER'");
     declare(suffix, "delete-domain-query","", "delete from domains where name=:domain");
     declare(suffix, "delete-zone-query", "", "delete from records where domain_id=:domain_id");
index 4748a8dddbb28af1c779bad54203407e4f570ddc..ed3a23de5a40abaf42eab5798814b93b29d64430 100644 (file)
@@ -21,7 +21,6 @@ CREATE TABLE records (
   content               VARCHAR(65535) DEFAULT NULL,
   ttl                   INTEGER DEFAULT NULL,
   prio                  INTEGER DEFAULT NULL,
-  change_date           INTEGER DEFAULT NULL,
   disabled              BOOLEAN DEFAULT 0,
   ordername             VARCHAR(255),
   auth                  BOOL DEFAULT 1,
index d85cf91cacdfdfc2344e5436c2225ad273828009..2d7c4d2ff2d223540f8e26dd85b3ec57aa70f955 100644 (file)
@@ -57,7 +57,7 @@ public:
     void lookup(const QType &qtype, const DNSName &qname, DNSPacket *p, int domain_id) override;
     bool get(DNSResourceRecord &rr) override;
     //! fills the soadata struct with the SOA details. Returns false if there is no SOA.
-    bool getSOA(const DNSName &name, SOAData &soadata, bool unmodifiedSerial) override;
+    bool getSOA(const DNSName &name, SOAData &soadata) override;
 
 
 //  MASTER BACKEND
index 9cc0bf63e4608ae2e9324034b79d76e7eef35ede..04af2b46c443309171bf1e7a0fa54c0c8620e2a9 100644 (file)
@@ -176,7 +176,7 @@ bool LUABackend::get(DNSResourceRecord &rr) {
     return !rr.content.empty();
 }
 
-bool LUABackend::getSOA(const DNSName &name, SOAData &soadata, bool unmodifiedSerial) {
+bool LUABackend::getSOA(const DNSName &name, SOAData &soadata) {
     if (logging)
        g_log << Logger::Info << backend_name << "(getsoa) BEGIN" << endl;
 
index 9f06e3e926994fd8e6a306e800a6b375e756b905..fb75faf28165effb59be3c5aed559b5addb3d967 100644 (file)
@@ -196,7 +196,7 @@ bool MyDNSBackend::list(const DNSName &target, int zoneId, bool include_disabled
   return true;
 }
 
-bool MyDNSBackend::getSOA(const DNSName& name, SOAData& soadata, bool unmodifiedSerial) {
+bool MyDNSBackend::getSOA(const DNSName& name, SOAData& soadata) {
   string query;
   SSqlStatement::row_t rrow;
 
index 434b51f2e88c48f1b3b387f937c733d564888e39..1e19af2f953a379ba429622e4751d58238760422 100644 (file)
@@ -39,7 +39,7 @@ public:
   void lookup(const QType &, const DNSName &qdomain, DNSPacket *p=0, int zoneId=-1) override;
   bool list(const DNSName &target, int domain_id, bool include_disabled=false) override;
   bool get(DNSResourceRecord &r) override;
-  bool getSOA(const DNSName& name, SOAData& soadata, bool unmodifiedSerial) override;
+  bool getSOA(const DNSName& name, SOAData& soadata) override;
   void getAllDomains(vector<DomainInfo> *domains, bool include_disabled=false) override;
 
 private:
index debfa508025379473b0d9e880ffc54832b2cdcfd..591ac7cbf2e7e6f890f894547ac9c6c009bd46d1 100644 (file)
@@ -184,7 +184,7 @@ bool OdbxBackend::getDomainInfo( const DNSName& domain, DomainInfo& di, bool get
 
 
 
-bool OdbxBackend::getSOA( const DNSName& domain, SOAData& sd, bool unmodifiedSerial)
+bool OdbxBackend::getSOA( const DNSName& domain, SOAData& sd )
 {
         const char* tmp;
 
@@ -215,7 +215,7 @@ bool OdbxBackend::getSOA( const DNSName& domain, SOAData& sd, bool unmodifiedSer
                                sd.ttl = strtoul( tmp, NULL, 10 );
                        }
 
-                       if( !unmodifiedSerial && sd.serial == 0 && ( tmp = odbx_field_value( m_result, 1 ) ) != NULL )
+                       if( sd.serial == 0 && ( tmp = odbx_field_value( m_result, 1 ) ) != NULL )
                        {
                                sd.serial = strtol( tmp, NULL, 10 );
                        }
index 8b8a67692985b921e70e5706dbb0207f5a253a79..bcf115019e4f900113abecef67416bd2fa063503 100644 (file)
@@ -77,7 +77,7 @@ public:
         ~OdbxBackend();
 
         void lookup( const QType& qtype, const DNSName& qdomain, DNSPacket* p = 0, int zoneid = -1 ) override;
-        bool getSOA( const DNSName& domain, SOAData& sd, bool unmodifiedSerial ) override;
+        bool getSOA( const DNSName& domain, SOAData& sd ) override;
         bool list( const DNSName& target, int domain_id, bool include_disabled=false ) override;
         bool get( DNSResourceRecord& rr ) override;
 
index 98ca2b16aea437b64966cf5e7e3f2186bfde25b6..b0abaa41edfd16feb79a024c5ff8bb69f295b710 100644 (file)
 
 static const char *basicQueryKey = "PDNS_Basic_Query";
 static const char *basicQueryDefaultAuthSQL =
-  "SELECT fqdn, ttl, type, content, zone_id, last_change, auth "
+  "SELECT fqdn, ttl, type, content, zone_id, auth "
   "FROM Records "
   "WHERE type = :type AND fqdn = lower(:name)";
 
-static const char *basicQueryDefaultSQL = "SELECT fqdn, ttl, type, content, zone_id, last_change "
+static const char *basicQueryDefaultSQL = "SELECT fqdn, ttl, type, content, zone_id, "
   "FROM Records "
   "WHERE type = :type AND fqdn = lower(:name)";
 
 static const char *basicIdQueryKey = "PDNS_Basic_Id_Query";
 static const char *basicIdQueryDefaultAuthSQL =
-  "SELECT fqdn, ttl, type, content, zone_id, last_change, auth "
+  "SELECT fqdn, ttl, type, content, zone_id, auth "
   "FROM Records "
   "WHERE type = :type AND fqdn = lower(:name) AND zone_id = :zoneid";
 
 static const char *basicIdQueryDefaultSQL = 
-  "SELECT fqdn, ttl, type, content, zone_id, last_change "
+  "SELECT fqdn, ttl, type, content, zone_id, "
   "FROM Records "
   "WHERE type = :type AND fqdn = lower(:name) AND zone_id = :zoneid";
 
 static const char *anyQueryKey = "PDNS_ANY_Query";
 static const char *anyQueryDefaultAuthSQL =
-  "SELECT fqdn, ttl, type, content, zone_id, last_change, auth "
+  "SELECT fqdn, ttl, type, content, zone_id, auth "
   "FROM Records "
   "WHERE fqdn = lower(:name)"
   "  AND type IS NOT NULL "
   "ORDER BY type";
 
 static const char *anyQueryDefaultSQL =
-  "SELECT fqdn, ttl, type, content, zone_id, last_change "
+  "SELECT fqdn, ttl, type, content, zone_id, "
   "FROM Records "
   "WHERE fqdn = lower(:name)"
   "  AND type IS NOT NULL "
@@ -75,7 +75,7 @@ static const char *anyQueryDefaultSQL =
 
 static const char *anyIdQueryKey = "PDNS_ANY_Id_Query";
 static const char *anyIdQueryDefaultAuthSQL =
-  "SELECT fqdn, ttl, type, content, zone_id, last_change, auth "
+  "SELECT fqdn, ttl, type, content, zone_id, auth "
   "FROM Records "
   "WHERE fqdn = lower(:name)"
   "  AND zone_id = :zoneid"
@@ -83,7 +83,7 @@ static const char *anyIdQueryDefaultAuthSQL =
   "ORDER BY type";
 
 static const char *anyIdQueryDefaultSQL =
-  "SELECT fqdn, ttl, type, content, zone_id, last_change "
+  "SELECT fqdn, ttl, type, content, zone_id, "
   "FROM Records "
   "WHERE fqdn = lower(:name)"
   "  AND zone_id = :zoneid"
@@ -93,14 +93,14 @@ static const char *anyIdQueryDefaultSQL =
 
 static const char *listQueryKey = "PDNS_List_Query";
 static const char *listQueryDefaultAuthSQL =
-  "SELECT fqdn, ttl, type, content, zone_id, last_change, auth "
+  "SELECT fqdn, ttl, type, content, zone_id, auth "
   "FROM Records "
   "WHERE zone_id = :zoneid"
   "  AND type IS NOT NULL "
   "ORDER BY fqdn, type";
 
 static const char *listQueryDefaultSQL =
-  "SELECT fqdn, ttl, type, content, zone_id, last_change "
+  "SELECT fqdn, ttl, type, content, zone_id, "
   "FROM Records "
   "WHERE zone_id = :zoneid"
   "  AND type IS NOT NULL "
index 39cca8f29bbeebcd8a51c734d9092b342b1f2125..3b4f520144c447262b02aedf833764620beab729 100644 (file)
@@ -115,7 +115,6 @@ CREATE TABLE Records (
   ttl NUMBER(10,0) NOT NULL,
   type VARCHAR2(32),
   content VARCHAR2(2048),
-  last_change INTEGER DEFAULT 0 NOT NULL,
   auth NUMBER(1,0) DEFAULT 1 NOT NULL,
   CONSTRAINT chk_records_fqdn CHECK (fqdn = lower(fqdn)),
   CONSTRAINT chk_records_ttl CHECK (ttl BETWEEN 0 AND 4294967295),
index b20803db90323998e68902841d1578e66e2fedb7..950aa27878bf728e34b6cca7afe8e180b44ca11e 100644 (file)
@@ -206,12 +206,6 @@ void HTTPConnector::restful_requestbuilder(const std::string &method, const Json
         addUrlComponent(parameters, "trxid", ss);
         req.preparePost();
         verb = "POST";
-    } else if (method == "calculateSOASerial") {
-        addUrlComponent(parameters, "domain", ss);
-        req.body = buildMemberListArgs("sd", parameters["sd"]);
-        req.headers["content-type"] = "application/x-www-form-urlencoded; charset=utf-8";
-        req.headers["content-length"] = std::to_string(req.body.size());
-        verb = "POST";
     } else if (method == "setDomainMetadata") {
         // copy all metadata values into post
         std::stringstream ss2;
index 42cb22b6b4d4971c9036f049c60d3ab031380b9a..b7d9ba8b4cd6536f96cb1b560894b0e9c6de82c7 100644 (file)
@@ -20,7 +20,6 @@ CREATE TABLE records (
   content         VARCHAR(65535) DEFAULT NULL,
   ttl             INTEGER DEFAULT NULL,
   prio            INTEGER DEFAULT NULL,
-  change_date     INTEGER DEFAULT NULL,
   ordername       VARCHAR(255) DEFAULT NULL,
   auth            BOOL DEFAULT 0
 );
index 078c556ad881c86fd7cbc750054f26a6c390161b..068562e62456c066fc2ef7c8be9e0be9ba7b8d8c 100644 (file)
@@ -828,34 +828,6 @@ bool RemoteBackend::abortTransaction() {
    return true;
 }
 
-bool RemoteBackend::calculateSOASerial(const DNSName& domain, const SOAData& sd, uint32_t& serial) {
-   Json query = Json::object{
-     { "method", "calculateSOASerial" },
-     { "parameters", Json::object{
-       { "domain", domain.toString() },
-       { "sd", Json::object{
-         { "qname", sd.qname.toString() },
-         { "nameserver", sd.nameserver.toString() },
-         { "hostmaster", sd.hostmaster.toString() },
-         { "ttl", static_cast<int>(sd.ttl) },
-         { "serial", static_cast<double>(sd.serial) },
-         { "refresh", static_cast<int>(sd.refresh) },
-         { "retry", static_cast<int>(sd.retry) },
-         { "expire", static_cast<int>(sd.expire) },
-         { "default_ttl", static_cast<int>(sd.default_ttl) },
-         { "domain_id", static_cast<int>(sd.domain_id) },
-       }}
-     }}
-   };
-
-   Json answer;
-   if (this->send(query) == false || this->recv(answer) == false)
-     return false;
-
-   serial = static_cast<unsigned int>(doubleFromJson(answer,"result"));
-   return true;
-}
-
 string RemoteBackend::directBackendCmd(const string& querystr) {
    Json query = Json::object{
      { "method", "directBackendCmd" },
index 9690f6f933295d3604fe0025d3b6a221f4ba541e..5747ef298983e3f819d60dd430de9dc7c0093558 100644 (file)
@@ -179,7 +179,6 @@ class RemoteBackend : public DNSBackend
   bool startTransaction(const DNSName& domain, int domain_id) override;
   bool commitTransaction() override;
   bool abortTransaction() override;
-  bool calculateSOASerial(const DNSName& domain, const SOAData& sd, uint32_t& serial) override;
   bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content) override;
   bool deleteTSIGKey(const DNSName& name) override;
   bool getTSIGKeys(std::vector< struct TSIGKey > &keys) override;
index 9c65bb3b86fd81427632f107f3638751587f9239..3049127ef514647091c9f7d1de2ffa374c796689 100644 (file)
@@ -318,16 +318,6 @@ BOOST_AUTO_TEST_CASE(test_method_abortTransaction) {
    BOOST_CHECK(be->abortTransaction());
 }
 
-BOOST_AUTO_TEST_CASE(test_method_calculateSOASerial) {
-   SOAData sd;
-   uint32_t serial;
-   be->getSOA(DNSName("unit.test."),sd);
-   BOOST_CHECK(be->calculateSOASerial(DNSName("unit.test."),sd,serial));
-
-   BOOST_CHECK_EQUAL(serial, 2013060300);
-}
-
 BOOST_AUTO_TEST_CASE(test_method_directBackendCmd) {
    BOOST_TEST_MESSAGE("Testing directBackendCmd method");
    BOOST_CHECK_EQUAL(be->directBackendCmd("PING 1234"), "PING 1234");
index cd439074e97955047b2640c13407dce07ed24696..2f69350bd4c01354865e1451263ef9fab4b4a0ee 100644 (file)
@@ -244,11 +244,6 @@ class Handler
    def do_aborttransaction(args)
      [true]
    end
-  
-   def do_calculatesoaserial(args)
-     return [2013060300] if args["sd"]["qname"] == "unit.test."
-     [false]
-   end
 
    def do_directbackendcmd(args)
      [args["query"]]
index d64a38030fff5d338d5bf39695f1733266eefb6d..74864b0047acae38ecd7f0857d4f4186b8ef58da 100644 (file)
@@ -72,7 +72,6 @@ GSQLBackend::GSQLBackend(const string &mode, const string &suffix)
   d_UpdateSerialOfZoneQuery=getArg("update-serial-query");
   d_UpdateLastCheckofZoneQuery=getArg("update-lastcheck-query");
   d_UpdateAccountOfZoneQuery=getArg("update-account-query");
-  d_ZoneLastChangeQuery=getArg("zone-lastchange-query");
   d_InfoOfAllMasterDomainsQuery=getArg("info-all-master-query");
   d_DeleteDomainQuery=getArg("delete-domain-query");
   d_DeleteZoneQuery=getArg("delete-zone-query");
@@ -146,7 +145,6 @@ GSQLBackend::GSQLBackend(const string &mode, const string &suffix)
   d_DeleteZoneQuery_stmt = NULL;
   d_DeleteRRSetQuery_stmt = NULL;
   d_DeleteNamesQuery_stmt = NULL;
-  d_ZoneLastChangeQuery_stmt = NULL;
   d_firstOrderQuery_stmt = NULL;
   d_beforeOrderQuery_stmt = NULL;
   d_afterOrderQuery_stmt = NULL;
@@ -1484,36 +1482,6 @@ bool GSQLBackend::abortTransaction()
   return true;
 }
 
-bool GSQLBackend::calculateSOASerial(const DNSName& domain, const SOAData& sd, uint32_t& serial)
-{
-  if (d_ZoneLastChangeQuery.empty()) {
-    // query not set => fall back to default impl
-    return DNSBackend::calculateSOASerial(domain, sd, serial);
-  }
-  
-  try {
-    reconnectIfNeeded();
-
-    d_ZoneLastChangeQuery_stmt->
-      bind("domain_id", sd.domain_id)->
-      execute()->
-      getResult(d_result)->
-      reset();
-  }
-  catch (const SSqlException& e) {
-    //DLOG(g_log<<"GSQLBackend unable to calculate SOA serial: " << e.txtReason()<<endl);
-    return false;
-  }
-  if (!d_result.empty()) {
-    ASSERT_ROW_COLUMNS("zone-lastchange-query", d_result[0], 1);
-    serial = pdns_stou(d_result[0][0]);
-    return true;
-  }
-
-  return false;
-}
-
 bool GSQLBackend::listComments(const uint32_t domain_id)
 {
   try {
index dd7e1b29952658d30b270cffa6d735fecd654e9c..7f27100fc981346101094e2067968cbb460d9133 100644 (file)
@@ -83,7 +83,6 @@ public:
       d_DeleteZoneQuery_stmt = d_db->prepare(d_DeleteZoneQuery, 1);
       d_DeleteRRSetQuery_stmt = d_db->prepare(d_DeleteRRSetQuery, 3);
       d_DeleteNamesQuery_stmt = d_db->prepare(d_DeleteNamesQuery, 2);
-      d_ZoneLastChangeQuery_stmt = d_db->prepare(d_ZoneLastChangeQuery, 1);
       d_firstOrderQuery_stmt = d_db->prepare(d_firstOrderQuery, 1);
       d_beforeOrderQuery_stmt = d_db->prepare(d_beforeOrderQuery, 2);
       d_afterOrderQuery_stmt = d_db->prepare(d_afterOrderQuery, 2);
@@ -145,7 +144,6 @@ public:
     d_DeleteZoneQuery_stmt.reset();
     d_DeleteRRSetQuery_stmt.reset();
     d_DeleteNamesQuery_stmt.reset();
-    d_ZoneLastChangeQuery_stmt.reset();
     d_firstOrderQuery_stmt.reset();
     d_beforeOrderQuery_stmt.reset();
     d_afterOrderQuery_stmt.reset();
@@ -213,8 +211,6 @@ public:
   bool updateEmptyNonTerminals(uint32_t domain_id, set<DNSName>& insert ,set<DNSName>& erase, bool remove) override;
   bool doesDNSSEC() override;
 
-  bool calculateSOASerial(const DNSName& domain, const SOAData& sd, uint32_t& serial) override;
-
   bool replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qt, const vector<DNSResourceRecord>& rrset) override;
   bool listSubZone(const DNSName &zone, int domain_id) override;
   bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) override;
@@ -299,7 +295,6 @@ private:
   string d_DeleteZoneQuery;
   string d_DeleteRRSetQuery;
   string d_DeleteNamesQuery;
-  string d_ZoneLastChangeQuery;
 
   string d_firstOrderQuery;
   string d_beforeOrderQuery;
@@ -369,7 +364,6 @@ private:
   unique_ptr<SSqlStatement> d_DeleteZoneQuery_stmt;
   unique_ptr<SSqlStatement> d_DeleteRRSetQuery_stmt;
   unique_ptr<SSqlStatement> d_DeleteNamesQuery_stmt;
-  unique_ptr<SSqlStatement> d_ZoneLastChangeQuery_stmt;
   unique_ptr<SSqlStatement> d_firstOrderQuery_stmt;
   unique_ptr<SSqlStatement> d_beforeOrderQuery_stmt;
   unique_ptr<SSqlStatement> d_afterOrderQuery_stmt;
index 025b6939232e59955aeb3ad1d6e0519b84cdc1d0..eb48835ea9117f1b170acab6a6150daca21298ee 100644 (file)
@@ -219,7 +219,7 @@ vector<DNSBackend *>BackendMakerClass::all(bool metadataOnly)
     \param sd SOAData which is filled with the SOA details
     \param unmodifiedSerial bool if set, serial will be returned as stored in the backend (maybe 0)
 */
-bool DNSBackend::getSOA(const DNSName &domain, SOAData &sd, bool unmodifiedSerial)
+bool DNSBackend::getSOA(const DNSName &domain, SOAData &sd)
 {
   this->lookup(QType(QType::SOA),domain);
 
@@ -251,18 +251,6 @@ bool DNSBackend::getSOA(const DNSName &domain, SOAData &sd, bool unmodifiedSeria
       sd.hostmaster=DNSName("hostmaster")+domain;
   }
 
-  if(!unmodifiedSerial && !sd.serial) { // magic time!
-    DLOG(g_log<<Logger::Warning<<"Doing SOA serial number autocalculation for "<<rr.qname<<endl);
-
-    uint32_t serial = 0;
-    if (calculateSOASerial(domain, sd, serial)) {
-      sd.serial = serial;
-      //DLOG(g_log<<"autocalculated soa serialnumber for "<<rr.qname<<" is "<<newest<<endl);
-    } else {
-      DLOG(g_log<<"soa serialnumber calculation failed for "<<rr.qname<<endl);
-    }
-
-  }
   sd.db=this;
   return true;
 }
@@ -323,38 +311,6 @@ bool DNSBackend::getBeforeAndAfterNames(uint32_t id, const DNSName& zonename, co
   return ret;
 }
 
-/**
- * Calculates a SOA serial for the zone and stores it in the third
- * argument. Returns false if calculation is not possible for some
- * reason (in this case, the third argument is not inspected). If it
- * returns true, the value returned in the third argument will be set
- * as the SOA serial.
- *
- * \param domain The name of the domain
- * \param sd Information about the SOA record already available
- * \param serial Output parameter. Only inspected when we return true
- */
-bool DNSBackend::calculateSOASerial(const DNSName& domain, const SOAData& sd, uint32_t& serial)
-{
-    // we do this by listing the domain and taking the maximum last modified timestamp
-
-    DNSResourceRecord i;
-    uint32_t newest=0;
-
-    if(!(this->list(domain, sd.domain_id))) {
-      DLOG(g_log<<Logger::Warning<<"Backend error trying to determine magic serial number of zone '"<<domain<<"'"<<endl);
-      return false;
-    }
-
-    while(this->get(i)) {
-      if(i.last_modified>newest)
-        newest=i.last_modified;
-    }
-
-    serial=newest;
-
-    return true;
-}
 void fillSOAData(const DNSZoneRecord& in, SOAData& sd)
 {
   sd.domain_id = in.domain_id;
index 901987f66aa8246a3a8aeb1c4011225a7d5da367..d5f26945ed9926ab74a76c0741177c381cd98235 100644 (file)
@@ -135,10 +135,7 @@ public:
   virtual ~DNSBackend(){};
 
   //! fills the soadata struct with the SOA details. Returns false if there is no SOA.
-  virtual bool getSOA(const DNSName &name, SOAData &soadata, bool unmodifiedSerial=false);
-
-  //! Calculates a SOA serial for the zone and stores it in the third argument.
-  virtual bool calculateSOASerial(const DNSName& domain, const SOAData& sd, uint32_t& serial);
+  virtual bool getSOA(const DNSName &name, SOAData &soadata);
 
   virtual bool replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qt, const vector<DNSResourceRecord>& rrset)
   {
index 7b87de5e06edd69218741e7ae555c326caf12ced..ce384877182aa600c1e89e1bbb77e722d6201bb7 100644 (file)
@@ -1068,15 +1068,11 @@ int PacketHandler::processUpdate(DNSPacket *p) {
 
 void PacketHandler::increaseSerial(const string &msgPrefix, const DomainInfo *di, bool haveNSEC3, bool narrow, const NSEC3PARAMRecordContent *ns3pr) {
   SOAData sd;
-  if (!di->backend->getSOA(di->zone, sd, true)) {
+  if (!di->backend->getSOA(di->zone, sd)) {
     throw PDNSException("SOA-Serial update failed because there was no SOA. Wowie.");
   }
 
   uint32_t oldSerial = sd.serial;
-  if (oldSerial == 0) { // using Autoserial, leave the serial alone.
-    g_log<<Logger::Notice<<msgPrefix<<"AutoSerial in use in domain \""<<di->zone.toLogString()<<"\", not updating SOA serial."<<endl;
-    return;
-  }
 
   vector<string> soaEdit2136Setting;
   B.getDomainMetadata(di->zone, "SOA-EDIT-DNSUPDATE", soaEdit2136Setting);
index 18633914d2c75629eac0c010b03dd4947276cb8a..6c3aecae1276ab01373b225405efda980b13dc8c 100644 (file)
@@ -398,22 +398,21 @@ bool UeberBackend::getSOA(const DNSName &domain, SOAData &sd)
   }
 
   // not found in neg. or pos. cache, look it up
-  return getSOAUncached(domain, sd, false);
+  return getSOAUncached(domain, sd);
 }
 
-bool UeberBackend::getSOAUncached(const DNSName &domain, SOAData &sd, bool unmodifiedSerial)
+bool UeberBackend::getSOAUncached(const DNSName &domain, SOAData &sd)
 {
   d_question.qtype=QType::SOA;
   d_question.qname=domain;
   d_question.zoneId=-1;
 
   for(vector<DNSBackend *>::const_iterator i=backends.begin();i!=backends.end();++i)
-    if((*i)->getSOA(domain, sd, unmodifiedSerial)) {
-      if(d_cache_ttl && !unmodifiedSerial) {
+    if((*i)->getSOA(domain, sd)) {
+      if(d_cache_ttl) {
         DNSZoneRecord rr;
         rr.dr.d_name = sd.qname;
         rr.dr.d_type = QType::SOA;
-        
         rr.dr.d_content = makeSOAContent(sd);
         rr.dr.d_ttl = sd.ttl;
         rr.domain_id = sd.domain_id;
index f044f9cae4651750657c36be3bb6fd0351d198e3..658c43590fe8fc730d6eca4d5834ba984d6f250a 100644 (file)
@@ -102,9 +102,8 @@ public:
   /** Determines if we are authoritative for a zone, and at what level */
   bool getAuth(const DNSName &target, const QType &qtype, SOAData* sd, bool cachedOk=true);
   bool getSOA(const DNSName &domain, SOAData &sd);
-  /** Load SOA info from backends, ignoring the cache. Callers that will write to the backend should use this
-   * function, possibly setting unmodifiedSerial=true when editing the SOA Serial. */
-  bool getSOAUncached(const DNSName &domain, SOAData &sd, bool unmodifiedSerial=false);
+  /** Load SOA info from backends, ignoring the cache.*/
+  bool getSOAUncached(const DNSName &domain, SOAData &sd);
   bool get(DNSZoneRecord &r);
   void getAllDomains(vector<DomainInfo> *domains, bool include_disabled=false);
 
index 2a4083631a2841a16d1e803c17e3d59b7789f07c..1d1847646216f9c5ef64a589b7b9908bebca7316 100644 (file)
@@ -694,7 +694,7 @@ static void updateDomainSettingsFromDocument(UeberBackend& B, const DomainInfo&
     di.backend->getDomainMetadataOne(zonename, "SOA-EDIT-API", soa_edit_api_kind);
     if (!soa_edit_api_kind.empty()) {
       SOAData sd;
-      if (!B.getSOAUncached(zonename, sd, true))
+      if (!B.getSOAUncached(zonename, sd))
         return;
 
       string soa_edit_kind;
@@ -1773,7 +1773,7 @@ static void patchZone(HttpRequest* req, HttpResponse* resp) {
     // edit SOA (if needed)
     if (!soa_edit_api_kind.empty() && !soa_edit_done) {
       SOAData sd;
-      if (!B.getSOAUncached(zonename, sd, true))
+      if (!B.getSOAUncached(zonename, sd))
         throw ApiException("No SOA found for domain '"+zonename.toString()+"'");
 
       DNSResourceRecord rr;
index 692cb3ec0701903bbf36a6a6c067e1234119a2c3..4099c5ca10ae167057abf7b43a65deecadea580c 100644 (file)
@@ -44,8 +44,8 @@ godbc-info-all-master-query=select id,name,master,last_check,notified_serial,typ
 godbc-info-all-slaves-query=select id,name,master,last_check from domains where type='SLAVE'
 godbc-info-zone-query=select id,name,master,last_check,notified_serial,type,account from domains where name=?
 godbc-insert-comment-query=INSERT INTO comments (domain_id, name, type, modified_at, account, comment) VALUES (?, ?, ?, ?, ?, ?)
-godbc-insert-empty-non-terminal-order-query=insert into records (type,domain_id,disabled,name,ordername,auth,ttl,prio,change_date,content) values (null,?,0,?,?,?,null,null,null,null)
-godbc-insert-record-query=insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth,change_date) values (?,?,?,?,?,?,?,?,?,null)
+godbc-insert-empty-non-terminal-order-query=insert into records (type,domain_id,disabled,name,ordername,auth,ttl,prio,content) values (null,?,0,?,?,?,null,null,null)
+godbc-insert-record-query=insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (?,?,?,?,?,?,?,?,?)
 godbc-insert-zone-query=insert into domains (type,name,master,account,last_check,notified_serial) values(?, ?, ?, ?, null, null)
 godbc-list-comments-query=SELECT domain_id,name,type,modified_at,account,comment FROM comments WHERE domain_id=?
 godbc-list-domain-keys-query=select cryptokeys.id, flags, active, content from domains, cryptokeys where cryptokeys.domain_id=domains.id and name=?
@@ -67,7 +67,6 @@ godbc-update-master-query=update domains set master=? where name=?
 godbc-update-ordername-and-auth-query=update records set ordername=?,auth=? where domain_id=? and name=? and disabled=0
 godbc-update-ordername-and-auth-type-query=update records set ordername=?,auth=? where domain_id=? and name=? and type=? and disabled=0
 godbc-update-serial-query=update domains set notified_serial=? where id=?
-godbc-zone-lastchange-query=select max(change_date) from records where domain_id=?
 __EOF__
 
                gsql_master godbc_sqlite3 nodyndns