More debugging

RR with CLASS TTL are not parsed correctly (yet)
This commit is contained in:
Miek Gieben 2011-12-14 16:02:21 +01:00
parent 824cb459fb
commit 5ea0337909
2 changed files with 8 additions and 6 deletions

View File

@ -187,7 +187,7 @@ func ParseZone(r io.Reader, cr chan RR) {
h.Rrtype, _ = Str_rr[strings.ToUpper(l.token)] h.Rrtype, _ = Str_rr[strings.ToUpper(l.token)]
st = _EXPECT_RDATA st = _EXPECT_RDATA
case _EXPECT_RDATA: case _EXPECT_RDATA:
r, e := setRR(h, c, l) r, e := setRR(h, c)
if e != nil { if e != nil {
fmt.Printf("%v\n", e) fmt.Printf("%v\n", e)
} }

View File

@ -30,7 +30,7 @@ func slurpRemainder(c chan Lex) error {
return nil 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 ( var (
r RR r RR
e error e error
@ -96,7 +96,8 @@ func setRR(h RR_Header, c chan Lex, currenttok Lex) (RR, error) {
case TypeTXT: case TypeTXT:
r, e = setTXT(h, c) r, e = setTXT(h, c)
default: 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 return r, e
} }
@ -291,8 +292,9 @@ func setNSEC(h RR_Header, c chan Lex) (RR, error) {
rr.Hdr = h rr.Hdr = h
l := <-c l := <-c
println("NSEC NEXTDOMAIN: ", l.token)
if !IsDomainName(l.token) { if !IsDomainName(l.token) {
return nil, &ParseError{"bad NSEC", l} return nil, &ParseError{"bad NSEC nextdomain", l}
} else { } else {
rr.NextDomain = l.token rr.NextDomain = l.token
} }
@ -305,12 +307,12 @@ func setNSEC(h RR_Header, c chan Lex) (RR, error) {
// Ok // Ok
case _STRING: case _STRING:
if k, ok := Str_rr[strings.ToUpper(l.token)]; !ok { 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 { } else {
rr.TypeBitMap = append(rr.TypeBitMap, k) rr.TypeBitMap = append(rr.TypeBitMap, k)
} }
default: default:
return nil, &ParseError{"bad NSEC", l} return nil, &ParseError{"bad NSEC garbage in type bitmap", l}
} }
l = <-c l = <-c
} }