From: Kees Monshouwer Date: Tue, 7 Aug 2018 10:20:39 +0000 (+0200) Subject: auth: remove autoserial X-Git-Tag: auth-4.2.0-alpha1~21^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76e1255a0862cd2f14492daeed621aac1aa1101d;p=thirdparty%2Fpdns.git auth: remove autoserial --- diff --git a/docs/backends/generic-mysql.rst b/docs/backends/generic-mysql.rst index 9f8cef76db..6247f9202d 100644 --- a/docs/backends/generic-mysql.rst +++ b/docs/backends/generic-mysql.rst @@ -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 diff --git a/docs/backends/generic-odbc.rst b/docs/backends/generic-odbc.rst index 150d43f7e8..65d4232532 100644 --- a/docs/backends/generic-odbc.rst +++ b/docs/backends/generic-odbc.rst @@ -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 diff --git a/docs/backends/generic-oracle.rst b/docs/backends/generic-oracle.rst index e2f1febbb3..f7401b32ac 100644 --- a/docs/backends/generic-oracle.rst +++ b/docs/backends/generic-oracle.rst @@ -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 diff --git a/docs/backends/generic-postgresql.rst b/docs/backends/generic-postgresql.rst index 0243a41277..3bb34ddb2d 100644 --- a/docs/backends/generic-postgresql.rst +++ b/docs/backends/generic-postgresql.rst @@ -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 diff --git a/docs/backends/generic-sql.rst b/docs/backends/generic-sql.rst index e1c8523a59..b1e2027f11 100644 --- a/docs/backends/generic-sql.rst +++ b/docs/backends/generic-sql.rst @@ -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 ~~~~~~~~~ diff --git a/docs/backends/oracle.rst b/docs/backends/oracle.rst index 75f69d3f24..64ad6c60fe 100644 --- a/docs/backends/oracle.rst +++ b/docs/backends/oracle.rst @@ -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 diff --git a/modules/gmysqlbackend/4.1.0_to_4.1.1_schema.mysql.sql b/modules/gmysqlbackend/4.1.0_to_5.0.0_schema.mysql.sql 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 6745c636bc..01efae925d 100644 --- a/modules/gmysqlbackend/4.1.0_to_4.1.1_schema.mysql.sql +++ b/modules/gmysqlbackend/4.1.0_to_5.0.0_schema.mysql.sql @@ -1 +1,3 @@ ALTER TABLE domains MODIFY notified_serial INT UNSIGNED DEFAULT NULL; + +ALTER TABLE records DROP COLUMN change_date; diff --git a/modules/gmysqlbackend/Makefile.am b/modules/gmysqlbackend/Makefile.am index aea6142cd7..db2c5ca5db 100644 --- a/modules/gmysqlbackend/Makefile.am +++ b/modules/gmysqlbackend/Makefile.am @@ -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 = \ diff --git a/modules/gmysqlbackend/gmysqlbackend.cc b/modules/gmysqlbackend/gmysqlbackend.cc index 1d0bed64d5..e3033abe3b 100644 --- a/modules/gmysqlbackend/gmysqlbackend.cc +++ b/modules/gmysqlbackend/gmysqlbackend.cc @@ -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=?"); diff --git a/modules/gmysqlbackend/schema.mysql.sql b/modules/gmysqlbackend/schema.mysql.sql index 1c6eee5a5b..2dea1c24cc 100644 --- a/modules/gmysqlbackend/schema.mysql.sql +++ b/modules/gmysqlbackend/schema.mysql.sql @@ -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 index 0000000000..f91046250f --- /dev/null +++ b/modules/godbcbackend/4.0.0_to_5.0.0_schema.mssql.sql @@ -0,0 +1 @@ +ALTER TABLE records DROP COLUMN change_date; diff --git a/modules/godbcbackend/Makefile.am b/modules/godbcbackend/Makefile.am index 199b848739..ce1c0af4ca 100644 --- a/modules/godbcbackend/Makefile.am +++ b/modules/godbcbackend/Makefile.am @@ -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 diff --git a/modules/godbcbackend/godbcbackend.cc b/modules/godbcbackend/godbcbackend.cc index 9db1f5ff79..7334df4c9d 100644 --- a/modules/godbcbackend/godbcbackend.cc +++ b/modules/godbcbackend/godbcbackend.cc @@ -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=?"); diff --git a/modules/godbcbackend/schema.mssql.sql b/modules/godbcbackend/schema.mssql.sql index 7a4c235dad..0bd56a012e 100644 --- a/modules/godbcbackend/schema.mssql.sql +++ b/modules/godbcbackend/schema.mssql.sql @@ -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, diff --git a/modules/goraclebackend/goraclebackend.cc b/modules/goraclebackend/goraclebackend.cc index 6a5d3e756e..f18c476307 100644 --- a/modules/goraclebackend/goraclebackend.cc +++ b/modules/goraclebackend/goraclebackend.cc @@ -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"); diff --git a/modules/goraclebackend/schema.goracle.sql b/modules/goraclebackend/schema.goracle.sql index f15fb93a2c..c2f9016db1 100644 --- a/modules/goraclebackend/schema.goracle.sql +++ b/modules/goraclebackend/schema.goracle.sql @@ -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 index 0000000000..f91046250f --- /dev/null +++ b/modules/gpgsqlbackend/4.1.0_to_5.0.0_schema.pgsql.sql @@ -0,0 +1 @@ +ALTER TABLE records DROP COLUMN change_date; diff --git a/modules/gpgsqlbackend/Makefile.am b/modules/gpgsqlbackend/Makefile.am index 8a820d516b..86818fa0df 100644 --- a/modules/gpgsqlbackend/Makefile.am +++ b/modules/gpgsqlbackend/Makefile.am @@ -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 \ diff --git a/modules/gpgsqlbackend/gpgsqlbackend.cc b/modules/gpgsqlbackend/gpgsqlbackend.cc index 5e108e978f..641f74bb1b 100644 --- a/modules/gpgsqlbackend/gpgsqlbackend.cc +++ b/modules/gpgsqlbackend/gpgsqlbackend.cc @@ -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"); diff --git a/modules/gpgsqlbackend/schema.pgsql.sql b/modules/gpgsqlbackend/schema.pgsql.sql index b105d87951..e6c6b7c3bc 100644 --- a/modules/gpgsqlbackend/schema.pgsql.sql +++ b/modules/gpgsqlbackend/schema.pgsql.sql @@ -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/enable_foreign_keys.sql b/modules/gsqlite3backend/3.4.0_to_4.0.0_schema.sqlite3.sql similarity index 100% rename from modules/gsqlite3backend/enable_foreign_keys.sql rename to modules/gsqlite3backend/3.4.0_to_4.0.0_schema.sqlite3.sql 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 index 0000000000..47c39addc3 --- /dev/null +++ b/modules/gsqlite3backend/4.0.0_to_5.0.0_schema.sqlite3.sql @@ -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; diff --git a/modules/gsqlite3backend/Makefile.am b/modules/gsqlite3backend/Makefile.am index c4566d5552..1580f59764 100644 --- a/modules/gsqlite3backend/Makefile.am +++ b/modules/gsqlite3backend/Makefile.am @@ -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 diff --git a/modules/gsqlite3backend/gsqlite3backend.cc b/modules/gsqlite3backend/gsqlite3backend.cc index 9bda9572ff..f9cb892fcb 100644 --- a/modules/gsqlite3backend/gsqlite3backend.cc +++ b/modules/gsqlite3backend/gsqlite3backend.cc @@ -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"); diff --git a/modules/gsqlite3backend/schema.sqlite3.sql b/modules/gsqlite3backend/schema.sqlite3.sql index 4748a8dddb..ed3a23de5a 100644 --- a/modules/gsqlite3backend/schema.sqlite3.sql +++ b/modules/gsqlite3backend/schema.sqlite3.sql @@ -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, diff --git a/modules/luabackend/luabackend.hh b/modules/luabackend/luabackend.hh index d85cf91cac..2d7c4d2ff2 100644 --- a/modules/luabackend/luabackend.hh +++ b/modules/luabackend/luabackend.hh @@ -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 diff --git a/modules/luabackend/minimal.cc b/modules/luabackend/minimal.cc index 9cc0bf63e4..04af2b46c4 100644 --- a/modules/luabackend/minimal.cc +++ b/modules/luabackend/minimal.cc @@ -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; diff --git a/modules/mydnsbackend/mydnsbackend.cc b/modules/mydnsbackend/mydnsbackend.cc index 9f06e3e926..fb75faf281 100644 --- a/modules/mydnsbackend/mydnsbackend.cc +++ b/modules/mydnsbackend/mydnsbackend.cc @@ -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; diff --git a/modules/mydnsbackend/mydnsbackend.hh b/modules/mydnsbackend/mydnsbackend.hh index 434b51f2e8..1e19af2f95 100644 --- a/modules/mydnsbackend/mydnsbackend.hh +++ b/modules/mydnsbackend/mydnsbackend.hh @@ -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 *domains, bool include_disabled=false) override; private: diff --git a/modules/opendbxbackend/odbxbackend.cc b/modules/opendbxbackend/odbxbackend.cc index debfa50802..591ac7cbf2 100644 --- a/modules/opendbxbackend/odbxbackend.cc +++ b/modules/opendbxbackend/odbxbackend.cc @@ -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 ); } diff --git a/modules/opendbxbackend/odbxbackend.hh b/modules/opendbxbackend/odbxbackend.hh index 8b8a676929..bcf115019e 100644 --- a/modules/opendbxbackend/odbxbackend.hh +++ b/modules/opendbxbackend/odbxbackend.hh @@ -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; diff --git a/modules/oraclebackend/oraclebackend.cc b/modules/oraclebackend/oraclebackend.cc index 98ca2b16ae..b0abaa41ed 100644 --- a/modules/oraclebackend/oraclebackend.cc +++ b/modules/oraclebackend/oraclebackend.cc @@ -39,35 +39,35 @@ 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 " diff --git a/modules/oraclebackend/schema.oracle.sql b/modules/oraclebackend/schema.oracle.sql index 39cca8f29b..3b4f520144 100644 --- a/modules/oraclebackend/schema.oracle.sql +++ b/modules/oraclebackend/schema.oracle.sql @@ -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), diff --git a/modules/remotebackend/httpconnector.cc b/modules/remotebackend/httpconnector.cc index b20803db90..950aa27878 100644 --- a/modules/remotebackend/httpconnector.cc +++ b/modules/remotebackend/httpconnector.cc @@ -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; diff --git a/modules/remotebackend/regression-tests/test-schema.sql b/modules/remotebackend/regression-tests/test-schema.sql index 42cb22b6b4..b7d9ba8b4c 100644 --- a/modules/remotebackend/regression-tests/test-schema.sql +++ b/modules/remotebackend/regression-tests/test-schema.sql @@ -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 ); diff --git a/modules/remotebackend/remotebackend.cc b/modules/remotebackend/remotebackend.cc index 078c556ad8..068562e624 100644 --- a/modules/remotebackend/remotebackend.cc +++ b/modules/remotebackend/remotebackend.cc @@ -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(sd.ttl) }, - { "serial", static_cast(sd.serial) }, - { "refresh", static_cast(sd.refresh) }, - { "retry", static_cast(sd.retry) }, - { "expire", static_cast(sd.expire) }, - { "default_ttl", static_cast(sd.default_ttl) }, - { "domain_id", static_cast(sd.domain_id) }, - }} - }} - }; - - Json answer; - if (this->send(query) == false || this->recv(answer) == false) - return false; - - serial = static_cast(doubleFromJson(answer,"result")); - return true; -} - string RemoteBackend::directBackendCmd(const string& querystr) { Json query = Json::object{ { "method", "directBackendCmd" }, diff --git a/modules/remotebackend/remotebackend.hh b/modules/remotebackend/remotebackend.hh index 9690f6f933..5747ef2989 100644 --- a/modules/remotebackend/remotebackend.hh +++ b/modules/remotebackend/remotebackend.hh @@ -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; diff --git a/modules/remotebackend/test-remotebackend.cc b/modules/remotebackend/test-remotebackend.cc index 9c65bb3b86..3049127ef5 100644 --- a/modules/remotebackend/test-remotebackend.cc +++ b/modules/remotebackend/test-remotebackend.cc @@ -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"); diff --git a/modules/remotebackend/unittest.rb b/modules/remotebackend/unittest.rb index cd439074e9..2f69350bd4 100644 --- a/modules/remotebackend/unittest.rb +++ b/modules/remotebackend/unittest.rb @@ -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"]] diff --git a/pdns/backends/gsql/gsqlbackend.cc b/pdns/backends/gsql/gsqlbackend.cc index d64a38030f..74864b0047 100644 --- a/pdns/backends/gsql/gsqlbackend.cc +++ b/pdns/backends/gsql/gsqlbackend.cc @@ -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()<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& insert ,set& 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& 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 d_DeleteZoneQuery_stmt; unique_ptr d_DeleteRRSetQuery_stmt; unique_ptr d_DeleteNamesQuery_stmt; - unique_ptr d_ZoneLastChangeQuery_stmt; unique_ptr d_firstOrderQuery_stmt; unique_ptr d_beforeOrderQuery_stmt; unique_ptr d_afterOrderQuery_stmt; diff --git a/pdns/dnsbackend.cc b/pdns/dnsbackend.cc index 025b693923..eb48835ea9 100644 --- a/pdns/dnsbackend.cc +++ b/pdns/dnsbackend.cc @@ -219,7 +219,7 @@ vectorBackendMakerClass::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<list(domain, sd.domain_id))) { - DLOG(g_log<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; diff --git a/pdns/dnsbackend.hh b/pdns/dnsbackend.hh index 901987f66a..d5f26945ed 100644 --- a/pdns/dnsbackend.hh +++ b/pdns/dnsbackend.hh @@ -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& rrset) { diff --git a/pdns/rfc2136handler.cc b/pdns/rfc2136handler.cc index 7b87de5e06..ce38487718 100644 --- a/pdns/rfc2136handler.cc +++ b/pdns/rfc2136handler.cc @@ -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<zone.toLogString()<<"\", not updating SOA serial."< soaEdit2136Setting; B.getDomainMetadata(di->zone, "SOA-EDIT-DNSUPDATE", soaEdit2136Setting); diff --git a/pdns/ueberbackend.cc b/pdns/ueberbackend.cc index 18633914d2..6c3aecae12 100644 --- a/pdns/ueberbackend.cc +++ b/pdns/ueberbackend.cc @@ -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::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; diff --git a/pdns/ueberbackend.hh b/pdns/ueberbackend.hh index f044f9cae4..658c43590f 100644 --- a/pdns/ueberbackend.hh +++ b/pdns/ueberbackend.hh @@ -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 *domains, bool include_disabled=false); diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 2a4083631a..1d18476462 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -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; diff --git a/regression-tests/backends/godbc_sqlite3-master b/regression-tests/backends/godbc_sqlite3-master index 692cb3ec07..4099c5ca10 100644 --- a/regression-tests/backends/godbc_sqlite3-master +++ b/regression-tests/backends/godbc_sqlite3-master @@ -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