fix unknown RRs (from miek)

This commit is contained in:
jakob 2004-05-18 11:33:09 +00:00
parent c5dea26ca2
commit e5db3b26c1
3 changed files with 77 additions and 2 deletions

View File

@ -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/

View File

@ -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++;
+ }
}
}

View File

@ -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)");}
;
%%