return DNS_ERR(NOT_IMPLEMENTED);
}
- werror = handle_question(dns, mem_ctx, &in->questions[0], &ans, &num_answers);
- if(W_ERROR_EQUAL(DNS_ERR(NAME_ERROR), werror)) {
+ if (dns_authorative_for_zone(dns, in->questions[0].name)) {
+ werror = handle_question(dns, mem_ctx, &in->questions[0], &ans, &num_answers);
+ } else {
DEBUG(2, ("I don't feel responsible for '%s', forwarding\n", in->questions[0].name));
werror = ask_forwarder(mem_ctx, &in->questions[0], &ans, &num_answers,
&ns, &num_nsrecs, &adds, &num_additional);
bool dns_name_equal(const char *name1, const char *name2);
bool dns_records_match(struct dnsp_DnssrvRpcRecord *rec1,
struct dnsp_DnssrvRpcRecord *rec2);
+bool dns_authorative_for_zone(struct dns_server *dns,
+ const char *name);
WERROR dns_lookup_records(struct dns_server *dns,
TALLOC_CTX *mem_ctx,
struct ldb_dn *dn,
return WERR_OK;
}
+bool dns_authorative_for_zone(struct dns_server *dns,
+ const char *name)
+{
+ const struct dns_server_zone *z;
+ size_t host_part_len = 0;
+
+ if (name == NULL) {
+ return false;
+ }
+
+ if (strcmp(name, "") == 0) {
+ return true;
+ }
+ for (z = dns->zones; z != NULL; z = z->next) {
+ bool match;
+
+ match = dns_name_match(z->name, name, &host_part_len);
+ if (match) {
+ break;
+ }
+ }
+ if (z == NULL) {
+ return false;
+ }
+
+ return true;
+}
+
WERROR dns_name2dn(struct dns_server *dns,
TALLOC_CTX *mem_ctx,
const char *name,