From fff09dae6d299a2b45bda44264c98cfde2348880 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 14 Oct 2015 11:59:26 +1300 Subject: [PATCH] dns_server: Give WERR_DNS_ERROR_NAME_DOES_NOT_EXIST on empty records When not looking for tombstones, a record without a dnsRecord value may as well not be present, so just return WERR_DNS_ERROR_NAME_DOES_NOT_EXIST Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam --- source4/dns_server/dnsserver_common.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/source4/dns_server/dnsserver_common.c b/source4/dns_server/dnsserver_common.c index 7199ef721d8..19aa75aafd3 100644 --- a/source4/dns_server/dnsserver_common.c +++ b/source4/dns_server/dnsserver_common.c @@ -149,15 +149,15 @@ WERROR dns_common_lookup(struct ldb_context *samdb, el = ldb_msg_find_element(msg, "dnsRecord"); if (el == NULL) { TALLOC_FREE(msg); + /* + * records produced by older Samba releases + * keep dnsNode objects without dnsRecord and + * without setting dNSTombstoned=TRUE. + * + * We just pretend they're tombstones. + */ if (tombstoned != NULL) { struct dnsp_DnssrvRpcRecord *recs; - /* - * records produced by older Samba releases - * keep dnsNode objects without dnsRecord and - * without setting dNSTombstoned=TRUE. - * - * We just pretend they're tombstones. - */ recs = talloc_array(mem_ctx, struct dnsp_DnssrvRpcRecord, 1); @@ -179,8 +179,14 @@ WERROR dns_common_lookup(struct ldb_context *samdb, *records = recs; *num_records = 1; return WERR_OK; + } else { + /* + * Because we are not looking for a tombstone + * in this codepath, we just pretend it does + * not exist at all. + */ + return WERR_DNS_ERROR_NAME_DOES_NOT_EXIST; } - return DNS_ERR(NAME_ERROR); } werr = dns_common_extract(el, mem_ctx, records, num_records);