Add DS recorsd
This commit is contained in:
parent
28bc54e91a
commit
0308dfbc9d
79
zscan_rr.go
79
zscan_rr.go
|
@ -84,10 +84,13 @@ func setRR(h RR_Header, c chan Lex) (RR, *ParseError) {
|
||||||
r, e = setNSEC(h, c)
|
r, e = setNSEC(h, c)
|
||||||
case TypeNSEC3:
|
case TypeNSEC3:
|
||||||
r, e = setNSEC3(h, c)
|
r, e = setNSEC3(h, c)
|
||||||
|
case TypeDS:
|
||||||
|
r, e = setDS(h, c)
|
||||||
case TypeTXT:
|
case TypeTXT:
|
||||||
r, e = setTXT(h, c)
|
r, e = setTXT(h, c)
|
||||||
default:
|
default:
|
||||||
// Don't the have the token the holds the RRtype
|
// Don't the have the token the holds the RRtype, but we substitute that in the
|
||||||
|
// calling function when lex is empty.
|
||||||
return nil, &ParseError{"Unknown RR type", Lex{}}
|
return nil, &ParseError{"Unknown RR type", Lex{}}
|
||||||
}
|
}
|
||||||
return r, e
|
return r, e
|
||||||
|
@ -290,7 +293,7 @@ func setRRSIG(h RR_Header, c chan Lex) (RR, *ParseError) {
|
||||||
}
|
}
|
||||||
// Get the remaining data until we see a NEWLINE
|
// Get the remaining data until we see a NEWLINE
|
||||||
l = <-c
|
l = <-c
|
||||||
var s string
|
s := ""
|
||||||
for l.value != _NEWLINE && l.value != _EOF {
|
for l.value != _NEWLINE && l.value != _EOF {
|
||||||
switch l.value {
|
switch l.value {
|
||||||
case _STRING:
|
case _STRING:
|
||||||
|
@ -455,6 +458,47 @@ func setDNSKEY(h RR_Header, c chan Lex) (RR, *ParseError) {
|
||||||
return rr, nil
|
return rr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setDS(h RR_Header, c chan Lex) (RR, *ParseError) {
|
||||||
|
rr := new(RR_DS)
|
||||||
|
rr.Hdr = h
|
||||||
|
l := <-c
|
||||||
|
if i, e := strconv.Atoi(l.token); e != nil {
|
||||||
|
return nil, &ParseError{"bad DS", l}
|
||||||
|
} else {
|
||||||
|
rr.KeyTag = uint16(i)
|
||||||
|
}
|
||||||
|
<-c // _BLANK
|
||||||
|
l = <-c
|
||||||
|
if i, e := strconv.Atoi(l.token); e != nil {
|
||||||
|
return nil, &ParseError{"bad DS", l}
|
||||||
|
} else {
|
||||||
|
rr.Algorithm = uint8(i)
|
||||||
|
}
|
||||||
|
<-c // _BLANK
|
||||||
|
l = <-c
|
||||||
|
if i, e := strconv.Atoi(l.token); e != nil {
|
||||||
|
return nil, &ParseError{"bad DS", l}
|
||||||
|
} else {
|
||||||
|
rr.DigestType = uint8(i)
|
||||||
|
}
|
||||||
|
// There can be spaces here...
|
||||||
|
l = <-c
|
||||||
|
s := ""
|
||||||
|
for l.value != _NEWLINE && l.value != _EOF {
|
||||||
|
switch l.value {
|
||||||
|
case _STRING:
|
||||||
|
s += l.token
|
||||||
|
case _BLANK:
|
||||||
|
// Ok
|
||||||
|
default:
|
||||||
|
return nil, &ParseError{"bad DS", l}
|
||||||
|
}
|
||||||
|
l = <-c
|
||||||
|
}
|
||||||
|
rr.Digest = s
|
||||||
|
return rr, nil
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
func setNSEC3PARAM(h RR_Header, c chan Lex) (RR, *ParseError) {
|
func setNSEC3PARAM(h RR_Header, c chan Lex) (RR, *ParseError) {
|
||||||
rr := new(RR_NSEC3PARAM)
|
rr := new(RR_NSEC3PARAM)
|
||||||
|
@ -504,37 +548,6 @@ func setTXT(h RR_Header, c chan Lex) (RR, *ParseError) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
func setDS(h RR_Header, c chan Lex) (RR, *ParseError) {
|
|
||||||
rr := new(RR_DS)
|
|
||||||
rr.Hdr = h
|
|
||||||
action setDS {
|
|
||||||
var (
|
|
||||||
i uint
|
|
||||||
e os.Error
|
|
||||||
)
|
|
||||||
rdf := fields(data[mark:p], 4)
|
|
||||||
rr := new(RR_DS)
|
|
||||||
rr.Hdr = hdr
|
|
||||||
rr.Hdr.Rrtype = TypeDS
|
|
||||||
if i, e = strconv.Atoi(rdf[0]); e != nil {
|
|
||||||
zp.Err <- &ParseError{Error: "bad DS", name: rdf[0], line: l}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
rr.KeyTag = uint16(i)
|
|
||||||
if i, e = strconv.Atoi(rdf[1]); e != nil {
|
|
||||||
zp.Err <- &ParseError{Error: "bad DS", name: rdf[1], line: l}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
rr.Algorithm = uint8(i)
|
|
||||||
if i, e = strconv.Atoi(rdf[2]); e != nil {
|
|
||||||
zp.Err <- &ParseError{Error: "bad DS", name: rdf[2], line: l}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
rr.DigestType = uint8(i)
|
|
||||||
rr.Digest = rdf[3]
|
|
||||||
zp.RR <- rr
|
|
||||||
}
|
|
||||||
|
|
||||||
func setCNAME(h RR_Header, c chan Lex) (RR, *ParseError) {
|
func setCNAME(h RR_Header, c chan Lex) (RR, *ParseError) {
|
||||||
rr := new(RR_CNAME)
|
rr := new(RR_CNAME)
|
||||||
rr.Hdr = h
|
rr.Hdr = h
|
||||||
|
|
Loading…
Reference in New Issue