summaryrefslogtreecommitdiff
path: root/source4/dns_server/dnsserver_common.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2017-12-18 16:22:23 +1300
committerAndrew Bartlett <abartlet@samba.org>2017-12-19 07:19:21 +0100
commit071ad56aef33c2bfb3840e1a114e17272e926890 (patch)
treefa6f2cdfcbe707597d9320abe734a69e1b2037a8 /source4/dns_server/dnsserver_common.c
parent93a5dce93308539fdd7b56903f3cabed59c0f37e (diff)
downloadsamba-071ad56aef33c2bfb3840e1a114e17272e926890.tar.gz
dns_server: Use the indexed "name" attribute in wildcard lookup
(the RDN, being 'dc' in this use case, does not have an index in the AD schema). 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.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/source4/dns_server/dnsserver_common.c b/source4/dns_server/dnsserver_common.c
index 217e65b39f4..b836e847fa7 100644
--- a/source4/dns_server/dnsserver_common.c
+++ b/source4/dns_server/dnsserver_common.c
@@ -305,6 +305,10 @@ static unsigned int number_of_labels(const struct ldb_val *name) {
*
* x.y.z -> (|(name=x.y.z)(name=\2a.y.z)(name=\2a.z)(name=\2a))
*
+ * The attribute 'name' is used as this is what the LDB index is on
+ * (the RDN, being 'dc' in this use case, does not have an index in
+ * the AD schema).
+ *
* Returns NULL if unable to build the query.
*
* The first component of the DN is assumed to be the name being looked up
@@ -318,7 +322,7 @@ static struct ldb_parse_tree *build_wildcard_query(
{
const struct ldb_val *name = NULL; /* The DNS name being
queried */
- const char *attr = NULL; /* The attribute name */
+ const char *attr = "name"; /* The attribute name */
struct ldb_parse_tree *query = NULL; /* The constructed query
parse tree*/
struct ldb_parse_tree *wildcard_query = NULL; /* The parse tree for the
@@ -326,12 +330,6 @@ static struct ldb_parse_tree *build_wildcard_query(
entries */
int labels = 0; /* The number of labels in the name */
- attr = ldb_dn_get_rdn_name(dn);
- if (attr == NULL) {
- DBG_ERR("Unable to get rdn_name\n");
- return NULL;
- }
-
name = ldb_dn_get_rdn_val(dn);
if (name == NULL) {
DBG_ERR("Unable to get domain name value\n");