Parsing a signed miek.nl works
This commit is contained in:
parent
c387c41767
commit
28bc54e91a
55
zscan_rr.go
55
zscan_rr.go
|
@ -65,6 +65,14 @@ func setRR(h RR_Header, c chan Lex) (RR, *ParseError) {
|
|||
if se := slurpRemainder(c); se != nil {
|
||||
return nil, se
|
||||
}
|
||||
case TypeSSHFP:
|
||||
r, e = setSSHFP(h, c)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
if se := slurpRemainder(c); se != nil {
|
||||
return nil, se
|
||||
}
|
||||
// These types have a variable ending either chunks of txt or chunks/base64 or hex.
|
||||
// They need to search for the end of the RR themselves, hence they look for the ending
|
||||
// newline. Thus there is no need to slurp the remainder, because there is none.
|
||||
|
@ -383,6 +391,29 @@ func setNSEC3(h RR_Header, c chan Lex) (RR, *ParseError) {
|
|||
return rr, nil
|
||||
}
|
||||
|
||||
func setSSHFP(h RR_Header, c chan Lex) (RR, *ParseError) {
|
||||
rr := new(RR_SSHFP)
|
||||
rr.Hdr = h
|
||||
|
||||
l := <-c
|
||||
if i, e := strconv.Atoi(l.token); e != nil {
|
||||
return nil, &ParseError{"bad SSHFP", l}
|
||||
} else {
|
||||
rr.Algorithm = uint8(i)
|
||||
}
|
||||
<-c // _BLANK
|
||||
l = <-c
|
||||
if i, e := strconv.Atoi(l.token); e != nil {
|
||||
return nil, &ParseError{"bad SSHFP", l}
|
||||
} else {
|
||||
rr.Type = uint8(i)
|
||||
}
|
||||
<-c // _BLANK
|
||||
l = <-c
|
||||
rr.FingerPrint = l.token
|
||||
return rr, nil
|
||||
}
|
||||
|
||||
func setDNSKEY(h RR_Header, c chan Lex) (RR, *ParseError) {
|
||||
rr := new(RR_DNSKEY)
|
||||
rr.Hdr = h
|
||||
|
@ -567,28 +598,4 @@ func setCNAME(h RR_Header, c chan Lex) (RR, *ParseError) {
|
|||
}
|
||||
|
||||
|
||||
func setSSHFP(h RR_Header, c chan Lex) (RR, *ParseError) {
|
||||
rr := new(RR_CNAME)
|
||||
rr.Hdr = h
|
||||
var (
|
||||
i int
|
||||
e os.Error
|
||||
)
|
||||
rdf := fields(data[mark:p], 3)
|
||||
rr := new(RR_SSHFP)
|
||||
rr.Hdr = hdr
|
||||
rr.Hdr.Rrtype = TypeSSHFP
|
||||
if i, e = strconv.Atoi(rdf[0]); e != nil {
|
||||
zp.Err <- &ParseError{Error: "bad SSHFP", name: rdf[0], line: l}
|
||||
return
|
||||
}
|
||||
rr.Algorithm = uint8(i)
|
||||
if i, e = strconv.Atoi(rdf[1]); e != nil {
|
||||
zp.Err <- &ParseError{Error: "bad SSHFP", name: rdf[1], line: l}
|
||||
return
|
||||
}
|
||||
rr.Type = uint8(i)
|
||||
rr.FingerPrint = rdf[2]
|
||||
zp.RR <- rr
|
||||
}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue