From e5db3b26c102f448c6b1070dfaf5330a1b72cb2f Mon Sep 17 00:00:00 2001 From: jakob Date: Tue, 18 May 2004 11:33:09 +0000 Subject: [PATCH] fix unknown RRs (from miek) --- net/nsd/Makefile | 4 +-- net/nsd/patches/patch-zlexer_lex | 56 ++++++++++++++++++++++++++++++++ net/nsd/patches/patch-zparser_y | 19 +++++++++++ 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 net/nsd/patches/patch-zlexer_lex create mode 100644 net/nsd/patches/patch-zparser_y diff --git a/net/nsd/Makefile b/net/nsd/Makefile index 223bf1a616a..2521ef788cb 100644 --- a/net/nsd/Makefile +++ b/net/nsd/Makefile @@ -1,10 +1,10 @@ -# $OpenBSD: Makefile,v 1.18 2004/05/14 18:43:54 jakob Exp $ +# $OpenBSD: Makefile,v 1.19 2004/05/18 11:33:09 jakob Exp $ COMMENT= "authoritative-only name server daemon" VERSION= 2.1.0 DISTNAME= nsd-${VERSION} -PKGNAME= nsd-${VERSION} +PKGNAME= nsd-${VERSION}p0 CATEGORIES= net MASTER_SITES= http://www.nlnetlabs.nl/downloads/nsd/ diff --git a/net/nsd/patches/patch-zlexer_lex b/net/nsd/patches/patch-zlexer_lex new file mode 100644 index 00000000000..a0194a46ead --- /dev/null +++ b/net/nsd/patches/patch-zlexer_lex @@ -0,0 +1,56 @@ +$OpenBSD: patch-zlexer_lex,v 1.3 2004/05/18 11:33:09 jakob Exp $ +--- zlexer.lex.orig 2004-03-04 13:10:58.000000000 +0100 ++++ zlexer.lex 2004-05-18 13:23:25.000000000 +0200 +@@ -240,12 +240,14 @@ zrrtype (char *word) + * 'A' is first token defined in YACC. With this hack we + * return the correct token based on our list of RR types + */ +- int i,j; +- /* known types */ ++ int i,j,l; ++ const char *c; ++ ++ l = strlen(word); ++ + i = 0; + while ( RRtypes[i] != NULL ) { +- /*for (i = 0; i < RRTYPES - 1; i++) {*/ +- if (strcasecmp(word, RRtypes[i]) == 0) { ++ if (strncasecmp(word, RRtypes[i],l) == 0) { + LEXOUT(("%s ", word)); + return i + A; + } +@@ -256,18 +258,23 @@ zrrtype (char *word) + j = intbytypexx(yytext); + + if ( j == 0 ) +- return 0; /* bail out here */ ++ return 0; + +- /* now it is TYPExxxx, and either we know it, or we don't */ +- LEXOUT(("TYPEx%d ", j)); +- +- /* [XXX] need better handling here, this is not 100% tight */ +- if ( j < DNSKEY ) { /* last known type */ +- return j + A; /* now it's know, well does it? */ +- } else { +- /* j == 0 is already handled */ +- LEXOUT(("UTYPE ")); ++ /* is the unknown known? */ ++ c = namebyint(j, ztypes); ++ if (c == NULL) { ++ LEXOUT(("TYPEx%d ", j)); + return UTYPE; ++ } else { ++ /* re-check the known types again */ ++ i = 0; ++ while ( RRtypes[i] != NULL ) { ++ if (strcasecmp(c, RRtypes[i]) == 0) { ++ LEXOUT(("%s ", c)); ++ return i + A; ++ } ++ i++; ++ } + } + } + diff --git a/net/nsd/patches/patch-zparser_y b/net/nsd/patches/patch-zparser_y new file mode 100644 index 00000000000..e7a65deb162 --- /dev/null +++ b/net/nsd/patches/patch-zparser_y @@ -0,0 +1,19 @@ +$OpenBSD: patch-zparser_y,v 1.1 2004/05/18 11:33:09 jakob Exp $ +--- zparser.y.orig 2004-04-22 15:39:47.000000000 +0200 ++++ zparser.y 2004-05-18 13:23:25.000000000 +0200 +@@ -661,12 +661,14 @@ rdata_unknown: URR sp STR sp hex_seq tra + /* $2 is the number of octects, currently ignored */ + zadd_rdata_wireformat(current_parser, zparser_conv_hex(zone_region, $5.str)); + } ++ | URR sp STR trail ++ { error_prev_line("\\# 0 not handled (yet)"); } + | URR error NL + { error_prev_line("Syntax error in UNKNOWN RR rdata"); } + ; + + rdata_unknown_err: URR error NL +- { error_prev_line("Not handled (yet)");} ++ { error_prev_line("UKNOWN RR rdata for this type not handled (yet)");} + ; + %% +