Handle placeholder KEYDATA record

A placeholder keydata record can appear in a zone file.  Allow them
to be read back in.
This commit is contained in:
Mark Andrews
2021-06-15 11:50:52 +10:00
parent f3bce65661
commit c6fa8a1d45
7 changed files with 75 additions and 2 deletions

View File

@@ -71,6 +71,11 @@ fromtext_keydata(ARGS_FROMTEXT) {
RETTOK(dns_secalg_fromtext(&alg, &token.value.as_textregion));
RETERR(mem_tobuffer(target, &alg, 1));
/* Do we have a placeholder KEYDATA record? */
if (flags == 0 && proto == 0 && alg == 0) {
return (ISC_R_SUCCESS);
}
/* No Key? */
if ((flags & 0xc000) == 0xc000) {
return (ISC_R_SUCCESS);
@@ -84,7 +89,7 @@ totext_keydata(ARGS_TOTEXT) {
isc_region_t sr;
char buf[sizeof("64000")];
unsigned int flags;
unsigned char algorithm;
unsigned char proto, algorithm;
unsigned long refresh, add, deltime;
char algbuf[DNS_NAME_FORMATSIZE];
const char *keyinfo;
@@ -132,7 +137,8 @@ totext_keydata(ARGS_TOTEXT) {
}
/* protocol */
snprintf(buf, sizeof(buf), "%u", sr.base[0]);
proto = sr.base[0];
snprintf(buf, sizeof(buf), "%u", proto);
isc_region_consume(&sr, 1);
RETERR(str_totext(buf, target));
RETERR(str_totext(" ", target));
@@ -143,6 +149,14 @@ totext_keydata(ARGS_TOTEXT) {
isc_region_consume(&sr, 1);
RETERR(str_totext(buf, target));
/* Do we have a placeholder KEYDATA record? */
if (flags == 0 && proto == 0 && algorithm == 0) {
if ((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0) {
RETERR(str_totext(" ; placeholder", target));
}
return (ISC_R_SUCCESS);
}
/* No Key? */
if ((flags & 0xc000) == 0xc000) {
return (ISC_R_SUCCESS);