summaryrefslogtreecommitdiff
path: root/source4/dns_server/dnsserver_common.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2017-12-15 12:30:50 +1300
committerAndrew Bartlett <abartlet@samba.org>2017-12-19 07:19:21 +0100
commit3efc879d98ba136d4d70e0e2d77fac9614186ab3 (patch)
treefd995fd7d9054f2f27607d4dc8532144b025e38a /source4/dns_server/dnsserver_common.c
parent948791aca70ca973755adcef27dc02da4c46f267 (diff)
downloadsamba-3efc879d98ba136d4d70e0e2d77fac9614186ab3.tar.gz
dns_server: Do the exact match query first, then do the wildcard lookup
The wildcard lookup is SCOPE_ONELEVEL combined with an index on the name attribute. This is not as efficient as a base DN lookup, so we try for that first. A not-found and wildcard response will still fall back to the ONELEVEL index. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13191 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'source4/dns_server/dnsserver_common.c')
-rw-r--r--source4/dns_server/dnsserver_common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source4/dns_server/dnsserver_common.c b/source4/dns_server/dnsserver_common.c
index 3e161f81ac7..6c7ab802575 100644
--- a/source4/dns_server/dnsserver_common.c
+++ b/source4/dns_server/dnsserver_common.c
@@ -563,6 +563,20 @@ WERROR dns_common_wildcard_lookup(struct ldb_context *samdb,
return werr;
}
+ /*
+ * Do a point search first, then fall back to a wildcard
+ * lookup if it does not exist
+ */
+ werr = dns_common_lookup(samdb,
+ mem_ctx,
+ dn,
+ records,
+ num_records,
+ NULL);
+ if (!W_ERROR_EQUAL(werr, WERR_DNS_ERROR_NAME_DOES_NOT_EXIST)) {
+ return werr;
+ }
+
ret = dns_wildcard_lookup(samdb, mem_ctx, dn, &msg);
if (ret == LDB_ERR_OPERATIONS_ERROR) {
return DNS_ERR(SERVER_FAILURE);