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)]
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)
}

View File

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