From: Evan Hunt Date: Thu, 9 Jan 2025 04:13:34 +0000 (-0800) Subject: deduplicate result codes X-Git-Tag: v9.21.5~31^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=314741fcd01e76be92c5e3918c6fb72ee9cc9b0a;p=thirdparty%2Fbind9.git deduplicate result codes ISCCC_R_SYNTAX, ISCCC_R_EXPIRED, and ISCCC_R_CLOCKSKEW have the same usage and text formats as DNS_R_SYNTAX, DNS_R_EXPIRED and DNS_R_CLOCKSCREW respectively. this was originally done because result codes were defined in separate libraries, and some tool might be linked with libisccc but not libdns. as the result codes are now defined in only one place, there's no need to retain the duplicates. --- diff --git a/bin/named/controlconf.c b/bin/named/controlconf.c index 1a96565bd99..bdf347157ef 100644 --- a/bin/named/controlconf.c +++ b/bin/named/controlconf.c @@ -489,7 +489,7 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result, if ((sent + CLOCKSKEW) < conn->now || (sent - CLOCKSKEW) > conn->now) { - result = ISCCC_R_CLOCKSKEW; + result = DNS_R_CLOCKSKEW; goto cleanup; } } else { @@ -503,7 +503,7 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result, if (isccc_cc_lookupuint32(conn->ctrl, "_exp", &exp) == ISC_R_SUCCESS && conn->now > exp) { - result = ISCCC_R_EXPIRED; + result = DNS_R_EXPIRED; goto cleanup; } diff --git a/lib/isc/include/isc/result.h b/lib/isc/include/isc/result.h index 734f7420500..fa281b95494 100644 --- a/lib/isc/include/isc/result.h +++ b/lib/isc/include/isc/result.h @@ -248,10 +248,7 @@ typedef enum isc_result { DNS_R_BADCOOKIE = DNS_R_NOERROR + 23, ISCCC_R_UNKNOWNVERSION, - ISCCC_R_SYNTAX, ISCCC_R_BADAUTH, - ISCCC_R_EXPIRED, - ISCCC_R_CLOCKSKEW, ISCCC_R_DUPLICATE, ISCCC_R_MAXDEPTH, diff --git a/lib/isc/result.c b/lib/isc/result.c index 298689babc5..67363786a21 100644 --- a/lib/isc/result.c +++ b/lib/isc/result.c @@ -248,10 +248,7 @@ static const char *description[ISC_R_NRESULTS] = { [DNS_R_BADCOOKIE] = "BADCOOKIE", [ISCCC_R_UNKNOWNVERSION] = "unknown version", - [ISCCC_R_SYNTAX] = "syntax error", [ISCCC_R_BADAUTH] = "bad auth", - [ISCCC_R_EXPIRED] = "expired", - [ISCCC_R_CLOCKSKEW] = "clock skew", [ISCCC_R_DUPLICATE] = "duplicate", [ISCCC_R_MAXDEPTH] = "max depth", }; @@ -482,10 +479,7 @@ static const char *identifier[ISC_R_NRESULTS] = { [DNS_R_BADCOOKIE] = "DNS_R_BADCOOKIE", [ISCCC_R_UNKNOWNVERSION] = "ISCCC_R_UNKNOWNVERSION", - [ISCCC_R_SYNTAX] = "ISCCC_R_SYNTAX", [ISCCC_R_BADAUTH] = "ISCCC_R_BADAUTH", - [ISCCC_R_EXPIRED] = "ISCCC_R_EXPIRED", - [ISCCC_R_CLOCKSKEW] = "ISCCC_R_CLOCKSKEW", [ISCCC_R_DUPLICATE] = "ISCCC_R_DUPLICATE", [ISCCC_R_MAXDEPTH] = "ISCCC_R_MAXDEPTH", }; diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c index 8bb50a616d4..4323a54c6b5 100644 --- a/lib/isccc/cc.c +++ b/lib/isccc/cc.c @@ -530,7 +530,7 @@ value_fromwire(isccc_region_t *source, unsigned int depth, } else if (msgtype == ISCCC_CCMSGTYPE_LIST) { result = list_fromwire(&active, depth + 1, valuep); } else { - result = ISCCC_R_SYNTAX; + result = DNS_R_SYNTAX; } return result;