From ff1b064f5e2bf19c8e25f8927d23df5714e666ed Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 11 Dec 2001 20:37:16 +0000 Subject: [PATCH] 1159. [bug] MD and MF are not permitted to be loaded by RFC1123. --- CHANGES | 2 ++ lib/dns/include/dns/result.h | 5 +++-- lib/dns/master.c | 24 +++++++++++++++++++++++- lib/dns/result.c | 6 ++++-- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index a03efd3840..fbeeb5178c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +1159. [bug] MD and MF are not permitted to be loaded by RFC1123. + 1158. [func] Report the client's address when logging notify messages. diff --git a/lib/dns/include/dns/result.h b/lib/dns/include/dns/result.h index edd0f0ee22..72bcdadf33 100644 --- a/lib/dns/include/dns/result.h +++ b/lib/dns/include/dns/result.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: result.h,v 1.83 2001/09/19 21:25:46 gson Exp $ */ +/* $Id: result.h,v 1.84 2001/12/11 20:37:16 marka Exp $ */ #ifndef DNS_RESULT_H #define DNS_RESULT_H 1 @@ -116,8 +116,9 @@ #define DNS_R_BADIXFR (ISC_RESULTCLASS_DNS + 77) #define DNS_R_NOTAUTHORITATIVE (ISC_RESULTCLASS_DNS + 78) #define DNS_R_NOVALIDKEY (ISC_RESULTCLASS_DNS + 79) +#define DNS_R_OBSOLETE (ISC_RESULTCLASS_DNS + 80) -#define DNS_R_NRESULTS 80 /* Number of results */ +#define DNS_R_NRESULTS 81 /* Number of results */ /* * DNS wire format rcodes. diff --git a/lib/dns/master.c b/lib/dns/master.c index 9353b667f7..ed1bbb3e67 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: master.c,v 1.131 2001/11/30 03:14:50 marka Exp $ */ +/* $Id: master.c,v 1.132 2001/12/11 20:37:14 marka Exp $ */ #include @@ -1378,6 +1378,28 @@ load(dns_loadctx_t *lctx) { if (type == dns_rdatatype_ns && ictx->glue == NULL) current_has_delegation = ISC_TRUE; + /* + * RFC 1123: MD and MF are not allowed to be loaded from + * master files. + */ + if ((lctx->options & DNS_MASTER_ZONE) != 0 && + (type == dns_rdatatype_md || type == dns_rdatatype_mf)) { + char typename[DNS_RDATATYPE_FORMATSIZE]; + + result = DNS_R_OBSOLETE; + + dns_rdatatype_format(type, typename, sizeof(typename)); + (*callbacks->error)(callbacks, + "%s: %s:%lu: %s '%s': %s", + "dns_master_load", source, line, + "type", typename, + dns_result_totext(result)); + if (MANYERRS(lctx, result)) { + SETRESULT(lctx, result); + } else + goto insist_and_cleanup; + } + /* * Find a rdata structure. */ diff --git a/lib/dns/result.c b/lib/dns/result.c index e2f36d7284..17ec7450c1 100644 --- a/lib/dns/result.c +++ b/lib/dns/result.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: result.c,v 1.92 2001/09/19 21:25:44 gson Exp $ */ +/* $Id: result.c,v 1.93 2001/12/11 20:37:13 marka Exp $ */ #include @@ -120,7 +120,9 @@ static const char *text[DNS_R_NRESULTS] = { "clocks are unsynchronized", /* 76 DNS_R_CLOCKSKEW */ "IXFR failed", /* 77 DNS_R_BADIXFR */ "not authoritative", /* 78 DNS_R_NOTAUTHORITATIVE */ - "no valid KEY" /* 79 DNS_R_NOVALIDKEY */ + "no valid KEY", /* 79 DNS_R_NOVALIDKEY */ + + "obsolete" /* 80 DNS_R_OBSOLETE */ }; static const char *rcode_text[DNS_R_NRCODERESULTS] = {