From 5ea033790909b75895a9ea7903b067b9a64e18c5 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 14 Dec 2011 16:02:21 +0100 Subject: [PATCH] More debugging RR with CLASS TTL are not parsed correctly (yet) --- zscan.go | 2 +- zscan_rr.go | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/zscan.go b/zscan.go index bd77da22..d3c438e4 100644 --- a/zscan.go +++ b/zscan.go @@ -187,7 +187,7 @@ func ParseZone(r io.Reader, cr chan RR) { h.Rrtype, _ = Str_rr[strings.ToUpper(l.token)] st = _EXPECT_RDATA case _EXPECT_RDATA: - r, e := setRR(h, c, l) + r, e := setRR(h, c) if e != nil { fmt.Printf("%v\n", e) } diff --git a/zscan_rr.go b/zscan_rr.go index d9a2be60..c35ba135 100644 --- a/zscan_rr.go +++ b/zscan_rr.go @@ -30,7 +30,7 @@ func slurpRemainder(c chan Lex) error { return nil } -func setRR(h RR_Header, c chan Lex, currenttok Lex) (RR, error) { +func setRR(h RR_Header, c chan Lex) (RR, error) { var ( r RR e error @@ -96,7 +96,8 @@ func setRR(h RR_Header, c chan Lex, currenttok Lex) (RR, error) { case TypeTXT: r, e = setTXT(h, c) default: - return nil, &ParseError{"Unknown RR type", currenttok} + // Don't the have the token the holds the RRtype + return nil, &ParseError{"Unknown RR type", Lex{} } } return r, e } @@ -291,8 +292,9 @@ func setNSEC(h RR_Header, c chan Lex) (RR, error) { rr.Hdr = h l := <-c + println("NSEC NEXTDOMAIN: ", l.token) if !IsDomainName(l.token) { - return nil, &ParseError{"bad NSEC", l} + return nil, &ParseError{"bad NSEC nextdomain", l} } else { rr.NextDomain = l.token } @@ -305,12 +307,12 @@ func setNSEC(h RR_Header, c chan Lex) (RR, error) { // Ok case _STRING: if k, ok := Str_rr[strings.ToUpper(l.token)]; !ok { - return nil, &ParseError{"bad NSEC", l} + return nil, &ParseError{"bad NSEC non RR in type bitmap", l} } else { rr.TypeBitMap = append(rr.TypeBitMap, k) } default: - return nil, &ParseError{"bad NSEC", l} + return nil, &ParseError{"bad NSEC garbage in type bitmap", l} } l = <-c }