]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
dlz_bind9: remove redundant logging in b9_record_match()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Mon, 12 Apr 2021 18:36:03 +0000 (06:36 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 11 Jun 2021 08:38:34 +0000 (08:38 +0000)
This log message will never be seen. We know because:

1. Always (two places) we are comparing an incoming record against a
   database record.

2. The incoming record has come from b9_parse(), which makes the same
   check.

3. If the database record is bad, we will never get here because the
   first check is b9_record_match() is

       if (rec1->wType != rec2->wType) {
               return false;
       }

   and rec1->wType is not going to equal the corrupt database record's
   wType, because point 2.

OK, but why? So we can shift this into dnsserver_common.c, because
the internal dns server has an inferior record_match() and it could do
with sharing this one.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dns_server/dlz_bind9.c

index 38fc15534beda58e17d17b842a6d17fd1532d4e8..eba4bebb8f5626c5dbc20372c235a1011bcfed48 100644 (file)
@@ -1753,11 +1753,12 @@ exit:
        return result;
 }
 
+
 /*
   see if two dns records match
  */
-static bool b9_record_match(struct dlz_bind9_data *state,
-                           struct dnsp_DnssrvRpcRecord *rec1, struct dnsp_DnssrvRpcRecord *rec2)
+static bool b9_record_match(struct dnsp_DnssrvRpcRecord *rec1,
+                           struct dnsp_DnssrvRpcRecord *rec2)
 {
        bool status;
        int i;
@@ -1827,8 +1828,6 @@ static bool b9_record_match(struct dlz_bind9_data *state,
                        rec1->data.soa.expire == rec2->data.soa.expire &&
                        rec1->data.soa.minimum == rec2->data.soa.minimum;
        default:
-               state->log(ISC_LOG_ERROR, "samba_dlz b9_record_match: unhandled record type %u",
-                          rec1->wType);
                break;
        }
 
@@ -1944,11 +1943,11 @@ _PUBLIC_ isc_result_t dlz_addrdataset(const char *name, const char *rdatastr, vo
                first = num_recs;
        }
 
-       /* there are existing records. We need to see if this will
+       /* there may be existing records. We need to see if this will
         * replace a record or add to it
         */
        for (i=first; i < num_recs; i++) {
-               if (b9_record_match(state, rec, &recs[i])) {
+               if (b9_record_match(rec, &recs[i])) {
                        break;
                }
        }
@@ -2066,7 +2065,7 @@ _PUBLIC_ isc_result_t dlz_subrdataset(const char *name, const char *rdatastr, vo
        }
 
        for (i=0; i < num_recs; i++) {
-               if (b9_record_match(state, rec, &recs[i])) {
+               if (b9_record_match(rec, &recs[i])) {
                        recs[i] = (struct dnsp_DnssrvRpcRecord) {
                                .wType = DNS_TYPE_TOMBSTONE,
                        };