Fix SOA parsing

This commit is contained in:
Miek Gieben 2011-12-16 11:16:26 +01:00
parent 4d5f6d66e2
commit c387c41767
2 changed files with 10 additions and 2 deletions

View File

@ -9,7 +9,7 @@ import (
)
// Only used when debugging the parser itself.
var _DEBUG = true
var _DEBUG = false
// Tokinize a RFC 1035 zone file. The tokenizer will normalize it:
// * Add ownernames if they are left blank;
@ -222,6 +222,11 @@ func ParseZone(r io.Reader, t chan Token) {
// I could save my token here...? l
r, e := setRR(h, c)
if e != nil {
// If e.Lex is nil than we have encounter a unknown RR type
// in that case we substitute our current Lex token
if e.lex.token == "" && e.lex.value == 0 {
e.lex = l // Uh, dirty
}
t <- Token{Error: e}
return
}

View File

@ -205,16 +205,19 @@ func setSOA(h RR_Header, c chan Lex) (RR, *ParseError) {
switch i {
case 0:
rr.Serial = uint32(j)
<-c // _BLANK
case 1:
rr.Refresh = uint32(j)
<-c // _BLANK
case 2:
rr.Retry = uint32(j)
<-c // _BLANK
case 3:
rr.Expire = uint32(j)
<-c // _BLANK
case 4:
rr.Minttl = uint32(j)
}
<-c // _BLANK
}
return rr, nil
}