Skip to content

Commit

Permalink
fix: always cache under lower-cased authname
Browse files Browse the repository at this point in the history
  • Loading branch information
developStorm committed Dec 14, 2024
1 parent b960441 commit c77f9d0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/zdns/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package zdns

import (
"strings"
"time"

log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -251,7 +252,7 @@ func (s *Cache) SafeAddCachedAnswer(q Question, res *SingleQueryResult, ns *Name
continue
}
baseAns := castAns.BaseAns()
if ok, _ = nameIsBeneath(baseAns.Name, layer); !ok {
if ok, _ = nameIsBeneath(baseAns.Name, layer); !ok && baseAns.Type != dns.TypeToString[dns.TypeNSEC3] {
if len(nsString) > 0 {
s.VerboseLog(depth+1, "SafeAddCachedAnswer: detected poison: ", baseAns.Name, "(", baseAns.Type, "): @", nsString, ", ", layer, " , aborting")
} else {
Expand Down Expand Up @@ -296,11 +297,11 @@ func (s *Cache) SafeAddCachedAuthority(res *SingleQueryResult, ns *NameServer, d
// We'll log in buildCachedResult
continue
}
baseAns := castAuth.BaseAns()
currName := strings.ToLower(castAuth.BaseAns().Name)
if len(authName) == 0 {
authName = baseAns.Name
} else if authName != baseAns.Name {
s.VerboseLog(depth+1, "SafeAddCachedAuthority: multiple authority names: ", layer, ": ", authName, " ", baseAns.Name, " , aborting")
authName = currName
} else if authName != currName {
s.VerboseLog(depth+1, "SafeAddCachedAuthority: multiple authority names: ", layer, ": ", authName, " ", currName, " , aborting")
return
}
}
Expand Down

0 comments on commit c77f9d0

Please sign in to comment.