mirror of
https://github.com/miekg/dns.git
synced 2025-08-14 21:46:58 +02:00
More tweaks
This commit is contained in:
parent
f78bc74d97
commit
eda63f2a29
91
zscan_rr.go
91
zscan_rr.go
@ -260,37 +260,54 @@ func setNSEC3(h RR_Header, c chan Lex) (RR, error) {
|
|||||||
rr := new(RR_NSEC3)
|
rr := new(RR_NSEC3)
|
||||||
rr.Hdr = h
|
rr.Hdr = h
|
||||||
|
|
||||||
rdf := fields(data[mark:p], 0)
|
l := <-c
|
||||||
|
if i, e = strconv.Atoui(l.token); e != nil {
|
||||||
|
return nil, &ParseError{"bad NSEC3", l}
|
||||||
|
} else {
|
||||||
|
rr.Hash = uint8(i)
|
||||||
|
}
|
||||||
|
<-c // _BLANK
|
||||||
|
l = <-c
|
||||||
|
if i, e = strconv.Atoui(l.token); e != nil {
|
||||||
|
return nil, &ParseError{"bad NSEC3", l}
|
||||||
|
} else {
|
||||||
|
rr.Flags = uint8(i)
|
||||||
|
}
|
||||||
|
<-c // _BLANK
|
||||||
|
l = <-c
|
||||||
|
if i, e = strconv.Atoui(l.token); e != nil {
|
||||||
|
return nil, &ParseError{"bad NSEC3", l}
|
||||||
|
} else {
|
||||||
|
rr.Iterations = uint16(i)
|
||||||
|
}
|
||||||
|
<-c
|
||||||
|
l = <-c
|
||||||
|
rr.SaltLength = uint8(len(l.token))
|
||||||
|
rr.Salt = l.token // CHECK?
|
||||||
|
|
||||||
if i, e = strconv.Atoui(rdf[0]); e != nil {
|
<-c
|
||||||
zp.Err <- &ParseError{Error: "bad NSEC3", name: rdf[0], line: l}
|
l = <-c
|
||||||
return
|
rr.HashLength = uint8(len(l.token))
|
||||||
}
|
rr.NextDomain = l.token
|
||||||
rr.Hash = uint8(i)
|
|
||||||
if i, e = strconv.Atoui(rdf[1]); e != nil {
|
|
||||||
zp.Err <- &ParseError{Error: "bad NSEC3", name: rdf[1], line: l}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
rr.Flags = uint8(i)
|
|
||||||
if i, e = strconv.Atoui(rdf[2]); e != nil {
|
|
||||||
zp.Err <- &ParseError{Error: "bad NSEC3", name: rdf[2], line: l}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
rr.Iterations = uint16(i)
|
|
||||||
rr.SaltLength = uint8(len(rdf[3]))
|
|
||||||
rr.Salt = rdf[3]
|
|
||||||
|
|
||||||
rr.HashLength = uint8(len(rdf[4]))
|
rr.TypeBitMap = make([]uint16, 0)
|
||||||
rr.NextDomain = rdf[4]
|
l = <-c
|
||||||
rr.TypeBitMap = make([]uint16, len(rdf)-5)
|
for l.value != _NEWLINE {
|
||||||
// Fill the Type Bit Map
|
case _BLANK:
|
||||||
for i := 5; i < len(rdf); i++ {
|
// Ok
|
||||||
// Check if its there in the map TODO
|
case _STRING:
|
||||||
rr.TypeBitMap[i-5] = str_rr[strings.ToUpper(rdf[i])]
|
if k, ok := str_rr[strings.ToUpper(l.token)]; !ok {
|
||||||
|
return nil, &ParseError{"bad NSEC3", l}
|
||||||
|
} else {
|
||||||
|
append(rr.TypeBitMap, k)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return nil, &ParseError{"bad NSEC3", l}
|
||||||
}
|
}
|
||||||
zp.RR <- rr
|
return rr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func setNSEC3PARAM(h RR_Header, c chan Lex) (RR, error) {
|
func setNSEC3PARAM(h RR_Header, c chan Lex) (RR, error) {
|
||||||
rr := new(RR_NSEC3PARAM)
|
rr := new(RR_NSEC3PARAM)
|
||||||
rr.Hdr = h
|
rr.Hdr = h
|
||||||
@ -314,13 +331,29 @@ func setNSEC3PARAM(h RR_Header, c chan Lex) (RR, error) {
|
|||||||
rr.SaltLength = uint8(len(rr.Salt))
|
rr.SaltLength = uint8(len(rr.Salt))
|
||||||
zp.RR <- rr
|
zp.RR <- rr
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func setTXT(h RR_Header, c chan Lex) (RR, error) {
|
func setTXT(h RR_Header, c chan Lex) (RR, error) {
|
||||||
rr := new(RR_TXT)
|
rr := new(RR_TXT)
|
||||||
rr.Hdr = h
|
rr.Hdr = h
|
||||||
rr.Txt = rdf[0]
|
|
||||||
zp.RR <- rr
|
// Get the remaining data until we see a NEWLINE
|
||||||
}
|
l := <-c
|
||||||
|
var s string
|
||||||
|
for l.value != _NEWLINE {
|
||||||
|
switch l.value {
|
||||||
|
case _STRING:
|
||||||
|
s += l.token
|
||||||
|
case _BLANK:
|
||||||
|
// Ok
|
||||||
|
default:
|
||||||
|
return nil, &ParseError{"bad TXT", l}
|
||||||
|
}
|
||||||
|
l = <-c
|
||||||
|
}
|
||||||
|
rr.Txt = s
|
||||||
|
return rr, nil
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
func setDS(h RR_Header, c chan Lex) (RR, error) {
|
func setDS(h RR_Header, c chan Lex) (RR, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user