1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

dlz_bind9: remove redundant logging in b9_record_match()

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>
This commit is contained in:
Douglas Bagnall 2021-04-13 06:36:03 +12:00 committed by Andrew Bartlett
parent 421dc7fc4d
commit f6025d9f34

View 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,
};