This commit is contained in:
Miek Gieben 2012-09-10 20:51:19 +02:00
parent d78c870779
commit 3a6edfa2c9
5 changed files with 13 additions and 15 deletions

View File

@ -142,7 +142,7 @@ func TestCompressLenght(t *testing.T) {
m.SetQuestion("miek.nl", TypeMX) m.SetQuestion("miek.nl", TypeMX)
ul := m.Len() ul := m.Len()
m.Compress = true m.Compress = true
if ul != m.Len(){ if ul != m.Len() {
t.Fatalf("Should be equal") t.Fatalf("Should be equal")
} }
} }

16
msg.go
View File

@ -222,7 +222,7 @@ func PackDomainName(s string, msg []byte, off int, compression map[string]int, c
// Emit sequence of counted strings, chopping at dots. // Emit sequence of counted strings, chopping at dots.
begin := 0 begin := 0
bs := []byte(s) bs := []byte(s)
// ls := len(bs) // ls := len(bs)
lens := ls lens := ls
for i := 0; i < ls; i++ { for i := 0; i < ls; i++ {
if bs[i] == '\\' { if bs[i] == '\\' {
@ -239,7 +239,7 @@ func PackDomainName(s string, msg []byte, off int, compression map[string]int, c
} }
// off can already (we're in a loop) be bigger than len(msg) // off can already (we're in a loop) be bigger than len(msg)
// this happens when a name isn't fully qualified // this happens when a name isn't fully qualified
if off+1 > len(msg) { if off+1 > len(msg) {
return lenmsg, false return lenmsg, false
} }
msg[off] = byte(i - begin) msg[off] = byte(i - begin)
@ -247,18 +247,18 @@ func PackDomainName(s string, msg []byte, off int, compression map[string]int, c
off++ off++
// TODO(mg): because of the new check above, this can go. But // TODO(mg): because of the new check above, this can go. But
// just leave it as is for the moment. // just leave it as is for the moment.
// if off > lenmsg { // if off > lenmsg {
// return lenmsg, false // return lenmsg, false
// } // }
for j := begin; j < i; j++ { for j := begin; j < i; j++ {
if off+1 > len(msg) { if off+1 > len(msg) {
return lenmsg, false return lenmsg, false
} }
msg[off] = bs[j] msg[off] = bs[j]
off++ off++
// if off > lenmsg { // if off > lenmsg {
// return lenmsg, false // return lenmsg, false
// } // }
} }
// Dont try to compress '.' // Dont try to compress '.'
if compression != nil && string(bs[begin:]) != ".'" { if compression != nil && string(bs[begin:]) != ".'" {

View File

@ -117,7 +117,7 @@ func (rr *RR_NSEC) MatchType(rrtype uint16) bool {
func (rr *RR_NSEC3) Cover(domain string) bool { func (rr *RR_NSEC3) Cover(domain string) bool {
hashdom := strings.ToUpper(HashName(domain, rr.Hash, rr.Iterations, rr.Salt)) hashdom := strings.ToUpper(HashName(domain, rr.Hash, rr.Iterations, rr.Salt))
nextdom := strings.ToUpper(rr.NextDomain) nextdom := strings.ToUpper(rr.NextDomain)
owner := strings.ToUpper(SplitLabels(rr.Header().Name)[0]) // The hashed part owner := strings.ToUpper(SplitLabels(rr.Header().Name)[0]) // The hashed part
apex := strings.ToUpper(HashName(strings.Join(SplitLabels(rr.Header().Name)[1:], "."), rr.Hash, rr.Iterations, rr.Salt)) + "." // The name of the zone apex := strings.ToUpper(HashName(strings.Join(SplitLabels(rr.Header().Name)[1:], "."), rr.Hash, rr.Iterations, rr.Salt)) + "." // The name of the zone
// if nextdomain equals the apex, it is considered The End. So in that case hashdom is always less then nextdomain // if nextdomain equals the apex, it is considered The End. So in that case hashdom is always less then nextdomain
if hashdom > owner && nextdom == apex { if hashdom > owner && nextdom == apex {

View File

@ -72,9 +72,9 @@ const (
TypeMAILA uint16 = 254 TypeMAILA uint16 = 254
TypeANY uint16 = 255 TypeANY uint16 = 255
TypeURI uint16 = 256 TypeURI uint16 = 256
TypeTA uint16 = 32768 TypeTA uint16 = 32768
TypeDLV uint16 = 32769 TypeDLV uint16 = 32769
// valid Question.Qclass // valid Question.Qclass
ClassINET = 1 ClassINET = 1

2
xfr.go
View File

@ -141,8 +141,6 @@ func checkXfrSOA(in *Msg, first bool) bool {
return false return false
} }
// XfrSend performs an outgoing [AI]xfr depending on the request message. The // XfrSend performs an outgoing [AI]xfr depending on the request message. The
// caller is responsible for sending the correct sequence of RR sets through // caller is responsible for sending the correct sequence of RR sets through
// the channel c. For reasons of symmetry XfrToken is re-used. // the channel c. For reasons of symmetry XfrToken is re-used.