summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2011-12-16 09:21:51 +0100
committerKai Blin <kai@samba.org>2011-12-17 02:46:08 +0100
commitdb2573eadfd9389391f6daf73432de7f73b46e81 (patch)
tree25f2db5d4ba43ce039322e29d3411f80f4bef78a
parenta00709eff1c3f9e53fcfbbc93ac498cb182c9ac7 (diff)
downloadsamba-db2573eadfd9389391f6daf73432de7f73b46e81.tar.gz
samba-db2573eadfd9389391f6daf73432de7f73b46e81.tar.bz2
samba-db2573eadfd9389391f6daf73432de7f73b46e81.zip
s4 dns: Implement dns name equality check
-rw-r--r--source4/dns_server/dns_server.h1
-rw-r--r--source4/dns_server/dns_utils.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/source4/dns_server/dns_server.h b/source4/dns_server/dns_server.h
index d658b2a492..0339fff01f 100644
--- a/source4/dns_server/dns_server.h
+++ b/source4/dns_server/dns_server.h
@@ -55,6 +55,7 @@ WERROR dns_server_process_update(struct dns_server *dns,
uint8_t werr_to_dns_err(WERROR werror);
bool dns_name_match(const char *zone, const char *name, size_t *host_part_len);
+bool dns_name_equal(const char *name1, const char *name2);
WERROR dns_name2dn(struct dns_server *dns,
TALLOC_CTX *mem_ctx,
const char *name,
diff --git a/source4/dns_server/dns_utils.c b/source4/dns_server/dns_utils.c
index 68c0c979da..f179546849 100644
--- a/source4/dns_server/dns_utils.c
+++ b/source4/dns_server/dns_utils.c
@@ -100,6 +100,15 @@ bool dns_name_match(const char *zone, const char *name, size_t *host_part_len)
return true;
}
+/* Names are equal if they match and there's nothing left over */
+bool dns_name_equal(const char *name1, const char *name2)
+{
+ size_t host_part_len;
+ bool ret = dns_name_match(name1, name2, &host_part_len);
+
+ return ret && (host_part_len == 0);
+}
+
WERROR dns_name2dn(struct dns_server *dns,
TALLOC_CTX *mem_ctx,
const char *name,