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. // 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
} }

View File

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