@@ -77,8 +77,8 @@ func readZoneFile(zoneName, fileName string) (*Zone, error) {
Zone := new(Zone)
Zone.Labels = make(labels)
- Zone.LenLabels = dns.LenLabels(Zone.Origin)
Zone.Origin = zoneName
+ Zone.LenLabels = dns.LenLabels(Zone.Origin)
if err == nil {
var objmap map[string]interface{}
@@ -8,7 +8,7 @@ import (
func getQuestionName(z *Zone, req *dns.Msg) string {
lx := dns.SplitLabels(req.Question[0].Name)
- ql := lx[0 : len(lx)-z.LenLabels-1]
+ ql := lx[0 : len(lx)-z.LenLabels]
return strings.Join(ql, ".")
}