summaryrefslogtreecommitdiff
path: root/source4/dns_server
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2014-10-29 13:35:36 +0100
committerKai Blin <kai@samba.org>2015-08-06 11:03:13 +0200
commitd7a54f33ef5d4f45127c9264f0c4f16a2a8a6541 (patch)
tree4f520daa5c9f351a7c580edb1bc2a8a37592ab68 /source4/dns_server
parent54cbecbe306eff1c36db5c98fdd106aeccdf096e (diff)
downloadsamba-d7a54f33ef5d4f45127c9264f0c4f16a2a8a6541.tar.gz
dns: Add dns_get_authoritative_zone helper function
Signed-off-by: Kai Blin <kai@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source4/dns_server')
-rw-r--r--source4/dns_server/dns_server.h2
-rw-r--r--source4/dns_server/dns_utils.c16
2 files changed, 18 insertions, 0 deletions
diff --git a/source4/dns_server/dns_server.h b/source4/dns_server/dns_server.h
index 3423ee03593..64b716a2542 100644
--- a/source4/dns_server/dns_server.h
+++ b/source4/dns_server/dns_server.h
@@ -93,6 +93,8 @@ bool dns_records_match(struct dnsp_DnssrvRpcRecord *rec1,
struct dnsp_DnssrvRpcRecord *rec2);
bool dns_authorative_for_zone(struct dns_server *dns,
const char *name);
+const char *dns_get_authoritative_zone(struct dns_server *dns,
+ const char *name);
WERROR dns_lookup_records(struct dns_server *dns,
TALLOC_CTX *mem_ctx,
struct ldb_dn *dn,
diff --git a/source4/dns_server/dns_utils.c b/source4/dns_server/dns_utils.c
index c757c157626..28412eb7681 100644
--- a/source4/dns_server/dns_utils.c
+++ b/source4/dns_server/dns_utils.c
@@ -199,6 +199,22 @@ bool dns_authorative_for_zone(struct dns_server *dns,
return true;
}
+const char *dns_get_authoritative_zone(struct dns_server *dns,
+ const char *name)
+{
+ const struct dns_server_zone *z;
+ size_t host_part_len = 0;
+
+ for (z = dns->zones; z != NULL; z = z->next) {
+ bool match;
+ match = dns_name_match(z->name, name, &host_part_len);
+ if (match) {
+ return z->name;
+ }
+ }
+ return NULL;
+}
+
WERROR dns_name2dn(struct dns_server *dns,
TALLOC_CTX *mem_ctx,
const char *name,