summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/dns_server/dnsserver_common.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source4/dns_server/dnsserver_common.c b/source4/dns_server/dnsserver_common.c
index 4982d3a37b1..7aac7e22855 100644
--- a/source4/dns_server/dnsserver_common.c
+++ b/source4/dns_server/dnsserver_common.c
@@ -491,13 +491,12 @@ WERROR dns_common_name2dn(struct ldb_context *samdb,
struct ldb_dn *dn;
const struct dns_server_zone *z;
size_t host_part_len = 0;
+ WERROR werr;
if (name == NULL) {
return DNS_ERR(FORMAT_ERROR);
}
- /*TODO: Check if 'name' is a valid DNS name */
-
if (strcmp(name, "") == 0) {
base = ldb_get_default_basedn(samdb);
dn = ldb_dn_copy(mem_ctx, base);
@@ -506,6 +505,12 @@ WERROR dns_common_name2dn(struct ldb_context *samdb,
return WERR_OK;
}
+ /* Check non-empty names */
+ werr = dns_name_check(mem_ctx, strlen(name), name);
+ if (!W_ERROR_IS_OK(werr)) {
+ return werr;
+ }
+
for (z = zones; z != NULL; z = z->next) {
bool match;