diff --git a/scan.go b/scan.go index 5f7f6442..a76f1d83 100644 --- a/scan.go +++ b/scan.go @@ -313,7 +313,7 @@ func parseZone(r io.Reader, origin, f string, t chan *Token, include int) { t <- &Token{Error: &ParseError{f, "too deeply nested $INCLUDE", l}} return } - parseZone(r1, l.token, neworigin, t, include+1) + parseZone(r1, neworigin, l.token, t, include+1) st = zExpectOwnerDir case zExpectDirTtlBl: if l.value != zBlank { diff --git a/scan_test.go b/scan_test.go index b31c4c77..e43ad447 100644 --- a/scan_test.go +++ b/scan_test.go @@ -21,13 +21,16 @@ func TestParseZoneInclude(t *testing.T) { t.Fatalf("could not close tmpfile %q: %s", tmpfile.Name(), err) } - zone := "$INCLUDE " + tmpfile.Name() + zone := "$ORIGIN example.org.\n$INCLUDE " + tmpfile.Name() tok := ParseZone(strings.NewReader(zone), "", "") for x := range tok { if x.Error != nil { t.Fatalf("expected no error, but got %s", x.Error) } + if x.RR.Header().Name != "foo.example.org." { + t.Fatalf("expected %s, but got %s", "foo.example.org.", x.RR.Header().Name) + } } os.Remove(tmpfile.Name())