From e25f9374b971b3d641cb055c1f2c321a8d7e553b Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Thu, 21 Mar 2019 16:12:26 +1300 Subject: [PATCH 1/2] dlz: Add test to ensure there are writable zones This is currently broken since 28e2a518ff32 BUG: https://bugzilla.samba.org/show_bug.cgi?id=13841 Signed-off-by: Garming Sam --- selftest/knownfail.d/bind9-dlz | 2 ++ source4/torture/dns/dlz_bind9.c | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 selftest/knownfail.d/bind9-dlz diff --git a/selftest/knownfail.d/bind9-dlz b/selftest/knownfail.d/bind9-dlz new file mode 100644 index 00000000000..84fc82f1f8b --- /dev/null +++ b/selftest/knownfail.d/bind9-dlz @@ -0,0 +1,2 @@ +^samba4.dlz_bind9.configure.configure.* +^samba4.dlz_bind9.multipleconfigure.multipleconfigure.* diff --git a/source4/torture/dns/dlz_bind9.c b/source4/torture/dns/dlz_bind9.c index a627e2351f7..e5aec26e20a 100644 --- a/source4/torture/dns/dlz_bind9.c +++ b/source4/torture/dns/dlz_bind9.c @@ -85,6 +85,8 @@ static bool test_dlz_bind9_create(struct torture_context *tctx) return true; } +static bool calls_zone_hook = false; + static isc_result_t dlz_bind9_writeable_zone_hook(dns_view_t *view, const char *zone_name) { @@ -119,6 +121,8 @@ static isc_result_t dlz_bind9_writeable_zone_hook(dns_view_t *view, } talloc_free(msg); + calls_zone_hook = true; + return ISC_R_SUCCESS; } @@ -138,12 +142,15 @@ static bool test_dlz_bind9_configure(struct torture_context *tctx) ISC_R_SUCCESS, "Failed to create samba_dlz"); + calls_zone_hook = false; torture_assert_int_equal(tctx, dlz_configure((void*)tctx, dbdata), ISC_R_SUCCESS, "Failed to configure samba_dlz"); dlz_destroy(dbdata); + torture_assert_int_equal(tctx, calls_zone_hook, 1, "Hasn't called zone hook"); + return true; } -- 2.17.1 From 51f9cf39caf82ec65079135e8e050cbd723056b3 Mon Sep 17 00:00:00 2001 From: Michael Saxl Date: Thu, 21 Mar 2019 18:22:38 +0100 Subject: [PATCH 2/2] s4:dlz make b9_has_soa check dc=@ node the zone node does not hold the dnsRecord values, so for the zone level the node dc=@,dc=zonename has to be queried regression introduced with 28e2a518ff32, BUG: https://bugzilla.samba.org/show_bug.cgi?id=13466 BUG: https://bugzilla.samba.org/show_bug.cgi?id=13841 Signed-off-by: Michael Saxl Reviewed-by: Garming Sam --- selftest/knownfail.d/bind9-dlz | 2 -- source4/dns_server/dlz_bind9.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) delete mode 100644 selftest/knownfail.d/bind9-dlz diff --git a/selftest/knownfail.d/bind9-dlz b/selftest/knownfail.d/bind9-dlz deleted file mode 100644 index 84fc82f1f8b..00000000000 --- a/selftest/knownfail.d/bind9-dlz +++ /dev/null @@ -1,2 +0,0 @@ -^samba4.dlz_bind9.configure.configure.* -^samba4.dlz_bind9.multipleconfigure.multipleconfigure.* diff --git a/source4/dns_server/dlz_bind9.c b/source4/dns_server/dlz_bind9.c index 070990db3cf..0e7fcfc2c25 100644 --- a/source4/dns_server/dlz_bind9.c +++ b/source4/dns_server/dlz_bind9.c @@ -1280,6 +1280,17 @@ static bool b9_has_soa(struct dlz_bind9_data *state, struct ldb_dn *dn, const ch return false; } + /* + * The SOA record is alwas stored under DC=@,DC=zonename + * This can probably be removed when dns_common_lookup makes a fallback + * lookup on @ pseudo record + */ + + if (!ldb_dn_add_child_fmt(dn,"DC=@")) { + talloc_free(tmp_ctx); + return false; + } + werr = dns_common_lookup(state->samdb, tmp_ctx, dn, &records, &num_records, NULL); if (!W_ERROR_IS_OK(werr)) { -- 2.17.1