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.
|
// Only used when debugging the parser itself.
|
||||||
var _DEBUG = true
|
var _DEBUG = false
|
||||||
|
|
||||||
// Tokinize a RFC 1035 zone file. The tokenizer will normalize it:
|
// Tokinize a RFC 1035 zone file. The tokenizer will normalize it:
|
||||||
// * Add ownernames if they are left blank;
|
// * 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
|
// I could save my token here...? l
|
||||||
r, e := setRR(h, c)
|
r, e := setRR(h, c)
|
||||||
if e != nil {
|
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}
|
t <- Token{Error: e}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,16 +205,19 @@ func setSOA(h RR_Header, c chan Lex) (RR, *ParseError) {
|
||||||
switch i {
|
switch i {
|
||||||
case 0:
|
case 0:
|
||||||
rr.Serial = uint32(j)
|
rr.Serial = uint32(j)
|
||||||
|
<-c // _BLANK
|
||||||
case 1:
|
case 1:
|
||||||
rr.Refresh = uint32(j)
|
rr.Refresh = uint32(j)
|
||||||
|
<-c // _BLANK
|
||||||
case 2:
|
case 2:
|
||||||
rr.Retry = uint32(j)
|
rr.Retry = uint32(j)
|
||||||
|
<-c // _BLANK
|
||||||
case 3:
|
case 3:
|
||||||
rr.Expire = uint32(j)
|
rr.Expire = uint32(j)
|
||||||
|
<-c // _BLANK
|
||||||
case 4:
|
case 4:
|
||||||
rr.Minttl = uint32(j)
|
rr.Minttl = uint32(j)
|
||||||
}
|
}
|
||||||
<-c // _BLANK
|
|
||||||
}
|
}
|
||||||
return rr, nil
|
return rr, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue