Fix SOA parsing
This commit is contained in:
parent
4d5f6d66e2
commit
c387c41767
7
zscan.go
7
zscan.go
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue