Update dnscontrol 3.15.0 -> 3.20.0
Add a fix to unbreak with go-1.19 ok paco@
This commit is contained in:
parent
78a82e6a51
commit
3a838ac516
|
@ -1,6 +1,6 @@
|
|||
COMMENT = manage DNS configuration across any number of DNS hosts
|
||||
|
||||
MODGO_VERSION = v3.15.0
|
||||
MODGO_VERSION = v3.20.0
|
||||
MODGO_MODNAME = github.com/StackExchange/dnscontrol/v3
|
||||
GH_ACCOUNT = StackExchange
|
||||
GH_PROJECT = dnscontrol
|
||||
|
@ -22,14 +22,19 @@ FIX_CLEANUP_PERMISSIONS = Yes
|
|||
|
||||
DOCDIR = ${PREFIX}/share/doc/dnscontrol
|
||||
|
||||
# zipexe.go is replaced during build with version from
|
||||
# https://github.com/42wim/go.zipexe to fix panic with go-1.19:
|
||||
# https://github.com/golang/go/issues/54227
|
||||
do-build:
|
||||
cd ${WRKSRC} && ${MODGO_CMD} generate ${MODGO_FLAGS}
|
||||
chmod u+w \
|
||||
${MODGO_WORKSPACE}/pkg/mod/github.com/daaku/go.zipexe@v1.0.1/zipexe.go
|
||||
cp ${FILESDIR}/zipexe.go \
|
||||
${MODGO_WORKSPACE}/pkg/mod/github.com/daaku/go.zipexe@v1.0.1/
|
||||
cd ${WRKSRC} && ${MODGO_CMD} build ${MODGO_FLAGS}
|
||||
cd ${WRKSRC}/cmd/convertzone && ${MODGO_CMD} build ${MODGO_FLAGS}
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/dnscontrol ${PREFIX}/bin/
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/cmd/convertzone/convertzone ${PREFIX}/bin/
|
||||
${INSTALL_DATA_DIR} ${DOCDIR}/providers
|
||||
${INSTALL_DATA} ${WRKSRC}/docs/_providers/*.md ${DOCDIR}/providers/
|
||||
${INSTALL_DATA} ${WRKSRC}/README.md ${WRKSRC}/docs/*.md ${DOCDIR}/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,132 @@
|
|||
// Package zipexe attempts to open an executable binary file as a zip file.
|
||||
package zipexe
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"debug/elf"
|
||||
"debug/macho"
|
||||
"debug/pe"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Opens a zip file by path.
|
||||
func Open(path string) (*zip.Reader, error) {
|
||||
_, rd, err := OpenCloser(path)
|
||||
return rd, err
|
||||
}
|
||||
|
||||
// OpenCloser is like Open but returns an additional Closer to avoid leaking open files.
|
||||
func OpenCloser(path string) (io.Closer, *zip.Reader, error) {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
finfo, err := file.Stat()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
zr, err := NewReader(file, finfo.Size())
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
return file, zr, nil
|
||||
}
|
||||
|
||||
// Open a zip file, specially handling various binaries that may have been
|
||||
// augmented with zip data.
|
||||
func NewReader(rda io.ReaderAt, size int64) (*zip.Reader, error) {
|
||||
handlers := []func(io.ReaderAt, int64) (*zip.Reader, error){
|
||||
zip.NewReader,
|
||||
zipExeReaderMacho,
|
||||
zipExeReaderElf,
|
||||
zipExeReaderPe,
|
||||
}
|
||||
|
||||
for _, handler := range handlers {
|
||||
zfile, err := handler(rda, size)
|
||||
if err == nil {
|
||||
return zfile, nil
|
||||
}
|
||||
}
|
||||
return nil, errors.New("Couldn't Open As Executable")
|
||||
}
|
||||
|
||||
// zipExeReaderMacho treats the file as a Mach-O binary
|
||||
// (Mac OS X / Darwin executable) and attempts to find a zip archive.
|
||||
func zipExeReaderMacho(rda io.ReaderAt, size int64) (*zip.Reader, error) {
|
||||
file, err := macho.NewFile(rda)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var max int64
|
||||
for _, load := range file.Loads {
|
||||
seg, ok := load.(*macho.Segment)
|
||||
if ok {
|
||||
// Check if the segment contains a zip file
|
||||
if zfile, err := zip.NewReader(seg, int64(seg.Filesz)); err == nil {
|
||||
return zfile, nil
|
||||
}
|
||||
|
||||
// Otherwise move end of file pointer
|
||||
end := int64(seg.Offset + seg.Filesz)
|
||||
if end > max {
|
||||
max = end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No zip file within binary, try appended to end
|
||||
section := io.NewSectionReader(rda, max, size-max)
|
||||
return zip.NewReader(section, section.Size())
|
||||
}
|
||||
|
||||
// zipExeReaderPe treats the file as a Portable Exectuable binary
|
||||
// (Windows executable) and attempts to find a zip archive.
|
||||
func zipExeReaderPe(rda io.ReaderAt, size int64) (*zip.Reader, error) {
|
||||
file, err := pe.NewFile(rda)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var max int64
|
||||
for _, sec := range file.Sections {
|
||||
// Check if this section has a zip file
|
||||
if zfile, err := zip.NewReader(sec, int64(sec.Size)); err == nil {
|
||||
return zfile, nil
|
||||
}
|
||||
|
||||
// Otherwise move end of file pointer
|
||||
end := int64(sec.Offset + sec.Size)
|
||||
if end > max {
|
||||
max = end
|
||||
}
|
||||
}
|
||||
|
||||
// No zip file within binary, try appended to end
|
||||
section := io.NewSectionReader(rda, max, size-max)
|
||||
return zip.NewReader(section, section.Size())
|
||||
}
|
||||
|
||||
// zipExeReaderElf treats the file as a ELF binary
|
||||
// (linux/BSD/etc... executable) and attempts to find a zip archive.
|
||||
func zipExeReaderElf(rda io.ReaderAt, size int64) (*zip.Reader, error) {
|
||||
file, err := elf.NewFile(rda)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var max int64
|
||||
|
||||
lastSection := file.Sections[len(file.Sections)-1]
|
||||
end := int64(lastSection.Offset + lastSection.Size)
|
||||
if end > max {
|
||||
max = end
|
||||
}
|
||||
|
||||
// No zip file within binary, try appended to end
|
||||
section := io.NewSectionReader(rda, max, size-max)
|
||||
return zip.NewReader(section, section.Size())
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,3 @@
|
|||
@bin bin/convertzone
|
||||
@bin bin/dnscontrol
|
||||
share/doc/dnscontrol/
|
||||
share/doc/dnscontrol/README.md
|
||||
|
@ -10,6 +9,7 @@ share/doc/dnscontrol/caa-builder.md
|
|||
share/doc/dnscontrol/check-creds.md
|
||||
share/doc/dnscontrol/cli-variables.md
|
||||
share/doc/dnscontrol/code-tricks.md
|
||||
share/doc/dnscontrol/creds-json.md
|
||||
share/doc/dnscontrol/examples.md
|
||||
share/doc/dnscontrol/get-certs.md
|
||||
share/doc/dnscontrol/get-zones.md
|
||||
|
@ -22,8 +22,8 @@ share/doc/dnscontrol/notifications.md
|
|||
share/doc/dnscontrol/opinions.md
|
||||
share/doc/dnscontrol/provider-list.md
|
||||
share/doc/dnscontrol/providers/
|
||||
share/doc/dnscontrol/providers/activedir.md
|
||||
share/doc/dnscontrol/providers/akamaiedgedns.md
|
||||
share/doc/dnscontrol/providers/autodns.md
|
||||
share/doc/dnscontrol/providers/axfrddns.md
|
||||
share/doc/dnscontrol/providers/azuredns.md
|
||||
share/doc/dnscontrol/providers/bind.md
|
||||
|
@ -35,6 +35,7 @@ share/doc/dnscontrol/providers/digitalocean.md
|
|||
share/doc/dnscontrol/providers/dnsimple.md
|
||||
share/doc/dnscontrol/providers/dnsmadeeasy.md
|
||||
share/doc/dnscontrol/providers/doh.md
|
||||
share/doc/dnscontrol/providers/domainnameshop.md
|
||||
share/doc/dnscontrol/providers/easyname.md
|
||||
share/doc/dnscontrol/providers/gandi_v5.md
|
||||
share/doc/dnscontrol/providers/gcloud.md
|
||||
|
@ -55,12 +56,15 @@ share/doc/dnscontrol/providers/ovh.md
|
|||
share/doc/dnscontrol/providers/packetframe.md
|
||||
share/doc/dnscontrol/providers/powerdns.md
|
||||
share/doc/dnscontrol/providers/route53.md
|
||||
share/doc/dnscontrol/providers/rwth.md
|
||||
share/doc/dnscontrol/providers/softlayer.md
|
||||
share/doc/dnscontrol/providers/transip.md
|
||||
share/doc/dnscontrol/providers/vultr.md
|
||||
share/doc/dnscontrol/release-engineering.md
|
||||
share/doc/dnscontrol/spf-optimizer.md
|
||||
share/doc/dnscontrol/testing-txt-records.md
|
||||
share/doc/dnscontrol/toc.md
|
||||
share/doc/dnscontrol/unittests.md
|
||||
share/doc/dnscontrol/v316.md
|
||||
share/doc/dnscontrol/why-the-dot.md
|
||||
share/doc/dnscontrol/writing-providers.md
|
||||
|
|
Loading…
Reference in New Issue