dns_server: Give WERR_DNS_ERROR_NAME_DOES_NOT_EXIST on empty records
authorAndrew Bartlett <abartlet@samba.org>
Tue, 13 Oct 2015 22:59:26 +0000 (11:59 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 26 Oct 2015 04:11:22 +0000 (05:11 +0100)
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 <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
source4/dns_server/dnsserver_common.c

index 7199ef721d872e69b08ac569c7706b9cb261120f..19aa75aafd3731bc54792ea82aa5e5167f7fd81c 100644 (file)
@@ -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);