[PATCH 1/5] dns: Add dns_get_authoritative_zone helper function
Kai Blin
kai at samba.org
Thu Jul 30 09:53:20 UTC 2015
Signed-off-by: Kai Blin <kai at samba.org>
---
source4/dns_server/dns_server.h | 2 ++
source4/dns_server/dns_utils.c | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/source4/dns_server/dns_server.h b/source4/dns_server/dns_server.h
index 3423ee0..64b716a 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 c757c15..28412eb 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,
--
1.9.1
More information about the samba-technical
mailing list