mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 02:33:14 -04:00
middleware/file: fix axfr error (#705)
Fixed in upstream, update miekg/dns to latest Fixes #598
This commit is contained in:
2
Gopkg.lock
generated
2
Gopkg.lock
generated
@@ -233,7 +233,7 @@
|
|||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/miekg/dns"
|
name = "github.com/miekg/dns"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "fb6fbed0f5ec4e418de4f156c18d2e4f9bc854e7"
|
revision = "e78414ef75607394ad7d917824f07f381df2eafa"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/opentracing/opentracing-go"
|
name = "github.com/opentracing/opentracing-go"
|
||||||
|
|||||||
11
vendor/github.com/miekg/dns/xfr.go
generated
vendored
11
vendor/github.com/miekg/dns/xfr.go
generated
vendored
@@ -1,6 +1,7 @@
|
|||||||
package dns
|
package dns
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -81,6 +82,10 @@ func (t *Transfer) inAxfr(id uint16, c chan *Envelope) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if first {
|
if first {
|
||||||
|
if in.Rcode != RcodeSuccess {
|
||||||
|
c <- &Envelope{in.Answer, &Error{err: fmt.Sprintf(errXFR, in.Rcode)}}
|
||||||
|
return
|
||||||
|
}
|
||||||
if !isSOAFirst(in) {
|
if !isSOAFirst(in) {
|
||||||
c <- &Envelope{in.Answer, ErrSoa}
|
c <- &Envelope{in.Answer, ErrSoa}
|
||||||
return
|
return
|
||||||
@@ -126,6 +131,10 @@ func (t *Transfer) inIxfr(id uint16, c chan *Envelope) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if first {
|
if first {
|
||||||
|
if in.Rcode != RcodeSuccess {
|
||||||
|
c <- &Envelope{in.Answer, &Error{err: fmt.Sprintf(errXFR, in.Rcode)}}
|
||||||
|
return
|
||||||
|
}
|
||||||
// A single SOA RR signals "no changes"
|
// A single SOA RR signals "no changes"
|
||||||
if len(in.Answer) == 1 && isSOAFirst(in) {
|
if len(in.Answer) == 1 && isSOAFirst(in) {
|
||||||
c <- &Envelope{in.Answer, nil}
|
c <- &Envelope{in.Answer, nil}
|
||||||
@@ -242,3 +251,5 @@ func isSOALast(in *Msg) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const errXFR = "bad xfr rcode: %d"
|
||||||
|
|||||||
27
vendor/github.com/miekg/dns/xfr_test.go
generated
vendored
27
vendor/github.com/miekg/dns/xfr_test.go
generated
vendored
@@ -4,6 +4,7 @@ package dns
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -16,8 +17,7 @@ func getIP(s string) string {
|
|||||||
return a[0]
|
return a[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
// flaky, need to setup local server and test from
|
// flaky, need to setup local server and test from that.
|
||||||
// that.
|
|
||||||
func TestAXFR_Miek(t *testing.T) {
|
func TestAXFR_Miek(t *testing.T) {
|
||||||
// This test runs against a server maintained by Miek
|
// This test runs against a server maintained by Miek
|
||||||
if testing.Short() {
|
if testing.Short() {
|
||||||
@@ -159,3 +159,26 @@ func testAXFRSIDN(t *testing.T, host, alg string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAXFRFailNotAuth(t *testing.T) {
|
||||||
|
// This tests run against a server maintained by SIDN labs, see:
|
||||||
|
// https://workbench.sidnlabs.nl/
|
||||||
|
if testing.Short() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
x := new(Transfer)
|
||||||
|
|
||||||
|
m := new(Msg)
|
||||||
|
m.SetAxfr("sidnlabs.nl.")
|
||||||
|
c, err := x.In(m, "yadifa.sidnlabs.nl:53")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for e := range c {
|
||||||
|
if e.Error != nil {
|
||||||
|
if !strings.HasPrefix(e.Error.Error(), "dns: bad xfr rcode:") {
|
||||||
|
t.Fatal(e.Error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user