Skip to content

Commit

Permalink
Backport PowerDNS#4650
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterlexis committed Nov 13, 2017
2 parents dd1f8dc + 0c09e41 commit c079ec2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
5 changes: 4 additions & 1 deletion modules/bindbackend/bindbackend2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,11 @@ void Bind2Backend::getAllDomains(vector<DomainInfo> *domains, bool include_disab
domains->push_back(di);
};
}

for(DomainInfo &di : *domains) {
// do not corrupt di if domain supplied by another backend.
if (di.backend != this)
continue;
this->getSOA(di.zone, soadata);
di.serial=soadata.serial;
}
Expand Down
1 change: 1 addition & 0 deletions regression-tests.api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
/acl.list
/recursor.conf
/rec-conf.d
/bindbackend.conf
15 changes: 11 additions & 4 deletions regression-tests.api/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@

AUTH_CONF_TPL = """
# Generated by runtests.py
launch=gsqlite3
launch=gsqlite3,bind
gsqlite3-dnssec=on
gsqlite3-database="""+SQLITE_DB+"""
module-dir=../regression-tests/modules
#
bind-config=bindbackend.conf
"""

BINDBACKEND_CONF_TPL = """
# Generated by runtests.py
"""

ACL_LIST_TPL = """
Expand Down Expand Up @@ -97,8 +101,11 @@ def ensure_empty_dir(name):
tf.seek(0, os.SEEK_SET) # rewind
subprocess.check_call(["sqlite3", SQLITE_DB], stdin=tf)

with open('pdns.conf', 'w') as named_conf:
named_conf.write(AUTH_CONF_TPL)
with open('bindbackend.conf', 'w') as bindbackend_conf:
bindbackend_conf.write(BINDBACKEND_CONF_TPL)

with open('pdns.conf', 'w') as pdns_conf:
pdns_conf.write(AUTH_CONF_TPL)

subprocess.check_call(PDNSUTIL_CMD + ["secure-zone", "powerdnssec.org"])
pdnscmd = ("../pdns/pdns_server --daemon=no --local-address=127.0.0.1 --local-port=5300 --socket-dir=./ --no-shuffle --dnsupdate=yes --cache-ttl=0 --config-dir=. --api=yes --webserver=yes --webserver-port="+WEBPORT+" --webserver-address=127.0.0.1 --webserver-password=something --api-key="+APIKEY).split()
Expand Down
2 changes: 2 additions & 0 deletions regression-tests.api/test_Zones.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ def test_list_zones(self):
example_com = [domain for domain in domains if domain['name'] in ('example.com', 'example.com.')]
self.assertEquals(len(example_com), 1)
example_com = example_com[0]
print(example_com)
required_fields = ['id', 'url', 'name', 'kind']
if is_auth():
required_fields = required_fields + ['masters', 'last_check', 'notified_serial', 'serial', 'account']
self.assertNotEquals(example_com['serial'], 0)
elif is_recursor():
required_fields = required_fields + ['recursion_desired', 'servers']
for field in required_fields:
Expand Down

0 comments on commit c079ec2

Please sign in to comment.