From 54d3d47daf9190275bbdaf8703b84969a4593451 Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Fri, 24 Mar 2017 23:31:34 -0700 Subject: PLT-6076 Adding viper libs for config file changes (#5871) * Adding viper libs for config file changes * Removing the old fsnotify lib * updating some missing libs --- vendor/github.com/miekg/dns/README.md | 1 + vendor/github.com/miekg/dns/client.go | 2 +- vendor/github.com/miekg/dns/issue_test.go | 47 ++++++++++++++++++++++++++++- vendor/github.com/miekg/dns/msg.go | 13 -------- vendor/github.com/miekg/dns/msg_generate.go | 13 ++++++-- vendor/github.com/miekg/dns/msg_helpers.go | 5 +++ vendor/github.com/miekg/dns/zmsg.go | 20 +++++++----- 7 files changed, 76 insertions(+), 25 deletions(-) (limited to 'vendor/github.com/miekg') diff --git a/vendor/github.com/miekg/dns/README.md b/vendor/github.com/miekg/dns/README.md index 2acc7f1ff..e8b0ec6a5 100644 --- a/vendor/github.com/miekg/dns/README.md +++ b/vendor/github.com/miekg/dns/README.md @@ -57,6 +57,7 @@ A not-so-up-to-date-list-that-may-be-actually-current: * https://github.com/fffaraz/microdns * http://quilt.io * https://github.com/ipdcode/hades (JD.COM) +* https://github.com/StackExchange/dnscontrol/ Send pull request if you want to be listed here. diff --git a/vendor/github.com/miekg/dns/client.go b/vendor/github.com/miekg/dns/client.go index d54d6422e..301dab9c1 100644 --- a/vendor/github.com/miekg/dns/client.go +++ b/vendor/github.com/miekg/dns/client.go @@ -103,7 +103,7 @@ func ExchangeConn(c net.Conn, m *Msg) (r *Msg, err error) { // case of truncation. // It is up to the caller to create a message that allows for larger responses to be // returned. Specifically this means adding an EDNS0 OPT RR that will advertise a larger -// buffer, see SetEdns0. Messsages without an OPT RR will fallback to the historic limit +// buffer, see SetEdns0. Messages without an OPT RR will fallback to the historic limit // of 512 bytes. func (c *Client) Exchange(m *Msg, a string) (r *Msg, rtt time.Duration, err error) { if !c.SingleInflight { diff --git a/vendor/github.com/miekg/dns/issue_test.go b/vendor/github.com/miekg/dns/issue_test.go index 3025fc98c..265ad56c0 100644 --- a/vendor/github.com/miekg/dns/issue_test.go +++ b/vendor/github.com/miekg/dns/issue_test.go @@ -2,7 +2,10 @@ package dns // Tests that solve that an specific issue. -import "testing" +import ( + "strings" + "testing" +) func TestTCPRtt(t *testing.T) { m := new(Msg) @@ -21,3 +24,45 @@ func TestTCPRtt(t *testing.T) { } } } + +func TestNSEC3MissingSalt(t *testing.T) { + rr, err := NewRR("ji6neoaepv8b5o6k4ev33abha8ht9fgc.example. NSEC3 1 1 12 aabbccdd K8UDEMVP1J2F7EG6JEBPS17VP3N8I58H") + if err != nil { + t.Fatalf("failed to parse example rr: %s", err) + } + m := new(Msg) + m.Answer = []RR{rr} + mb, err := m.Pack() + if err != nil { + t.Fatalf("expected to pack message. err: %s", err) + } + if err := m.Unpack(mb); err != nil { + t.Fatalf("expected to unpack message. missing salt? err: %s", err) + } + in := rr.(*NSEC3).Salt + out := m.Answer[0].(*NSEC3).Salt + if in != out { + t.Fatalf("expected salts to match. packed: `%s`. returned: `%s`", in, out) + } +} + +func TestNSEC3MixedNextDomain(t *testing.T) { + rr, err := NewRR("ji6neoaepv8b5o6k4ev33abha8ht9fgc.example. NSEC3 1 1 12 - k8udemvp1j2f7eg6jebps17vp3n8i58h") + if err != nil { + t.Fatalf("failed to parse example rr: %s", err) + } + m := new(Msg) + m.Answer = []RR{rr} + mb, err := m.Pack() + if err != nil { + t.Fatalf("expected to pack message. err: %s", err) + } + if err := m.Unpack(mb); err != nil { + t.Fatalf("expected to unpack message. err: %s", err) + } + in := strings.ToUpper(rr.(*NSEC3).NextDomain) + out := m.Answer[0].(*NSEC3).NextDomain + if in != out { + t.Fatalf("expected round trip to produce NextDomain `%s`, instead `%s`", in, out) + } +} diff --git a/vendor/github.com/miekg/dns/msg.go b/vendor/github.com/miekg/dns/msg.go index b5c074f05..57262a10c 100644 --- a/vendor/github.com/miekg/dns/msg.go +++ b/vendor/github.com/miekg/dns/msg.go @@ -327,7 +327,6 @@ End: // UnpackDomainName unpacks a domain name into a string. func UnpackDomainName(msg []byte, off int) (string, int, error) { s := make([]byte, 0, 64) - labels := 0 off1 := 0 lenmsg := len(msg) ptr := 0 // number of pointers followed @@ -370,15 +369,6 @@ Loop: } } } - // never exceed the allowed label count lenght (63) - if labels >= 63 { - return "", lenmsg, &Error{err: "name exceeds 63 labels"} - } - labels += 1 - // never exceed the allowed doman name length (255 octets) - if len(s) >= 255 { - return "", lenmsg, &Error{err: "name exceeded allowed 255 octets"} - } s = append(s, '.') off += c case 0xC0: @@ -398,9 +388,6 @@ Loop: if ptr++; ptr > 10 { return "", lenmsg, &Error{err: "too many compression pointers"} } - // pointer should guarantee that it advances and points forwards at least - // but the condition on previous three lines guarantees that it's - // at least loop-free off = (c^0xC0)<<8 | int(c1) default: // 0x80 and 0x40 are reserved diff --git a/vendor/github.com/miekg/dns/msg_generate.go b/vendor/github.com/miekg/dns/msg_generate.go index c29447a10..4d9f81d43 100644 --- a/vendor/github.com/miekg/dns/msg_generate.go +++ b/vendor/github.com/miekg/dns/msg_generate.go @@ -139,8 +139,17 @@ return off, err case st.Tag(i) == `dns:"base64"`: o("off, err = packStringBase64(rr.%s, msg, off)\n") - case strings.HasPrefix(st.Tag(i), `dns:"size-hex:SaltLength`): // Hack to fix empty salt length for NSEC3 - o("if rr.%s == \"-\" { /* do nothing, empty salt */ }\n") + case strings.HasPrefix(st.Tag(i), `dns:"size-hex:SaltLength`): + // directly write instead of using o() so we get the error check in the correct place + field := st.Field(i).Name() + fmt.Fprintf(b, `// Only pack salt if value is not "-", i.e. empty +if rr.%s != "-" { + off, err = packStringHex(rr.%s, msg, off) + if err != nil { + return off, err + } +} +`, field, field) continue case strings.HasPrefix(st.Tag(i), `dns:"size-hex`): // size-hex can be packed just like hex fallthrough diff --git a/vendor/github.com/miekg/dns/msg_helpers.go b/vendor/github.com/miekg/dns/msg_helpers.go index 494c05377..615274ab0 100644 --- a/vendor/github.com/miekg/dns/msg_helpers.go +++ b/vendor/github.com/miekg/dns/msg_helpers.go @@ -142,6 +142,11 @@ func truncateMsgFromRdlength(msg []byte, off int, rdlength uint16) (truncmsg []b } func fromBase32(s []byte) (buf []byte, err error) { + for i, b := range s { + if b >= 'a' && b <= 'z' { + s[i] = b - 32 + } + } buflen := base32.HexEncoding.DecodedLen(len(s)) buf = make([]byte, buflen) n, err := base32.HexEncoding.Decode(buf, s) diff --git a/vendor/github.com/miekg/dns/zmsg.go b/vendor/github.com/miekg/dns/zmsg.go index 94627e35e..9b98e1bb2 100644 --- a/vendor/github.com/miekg/dns/zmsg.go +++ b/vendor/github.com/miekg/dns/zmsg.go @@ -801,10 +801,12 @@ func (rr *NSEC3) pack(msg []byte, off int, compression map[string]int, compress if err != nil { return off, err } - if rr.Salt == "-" { /* do nothing, empty salt */ - } - if err != nil { - return off, err + // Only pack salt if value is not "-", i.e. empty + if rr.Salt != "-" { + off, err = packStringHex(rr.Salt, msg, off) + if err != nil { + return off, err + } } off, err = packUint8(rr.HashLength, msg, off) if err != nil { @@ -844,10 +846,12 @@ func (rr *NSEC3PARAM) pack(msg []byte, off int, compression map[string]int, comp if err != nil { return off, err } - if rr.Salt == "-" { /* do nothing, empty salt */ - } - if err != nil { - return off, err + // Only pack salt if value is not "-", i.e. empty + if rr.Salt != "-" { + off, err = packStringHex(rr.Salt, msg, off) + if err != nil { + return off, err + } } rr.Header().Rdlength = uint16(off - headerEnd) return off, nil -- cgit v1.2.3-1-g7c22