From 24dcc56123634e048dc0c7d8fa2eeff65b97a33a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 11 Jun 2019 16:01:53 +0200 Subject: [PATCH 1/2] bump docker-credential-helpers v0.6.2 full diff: https://github.com/docker/docker-credential-helpers/compare/5241b46610f2491efdf9d1c85f1ddf5b02f6d962...8a9f93a99ff87f416cc79f267c68151af0026f60 includes: - docker/docker-credential-helpers#29 C.free(unsafe.Pointer(err)) -> C.g_error_free(err) - docker/docker-credential-helpers#124 pass: changed the way for checking if password-store is initalized - addresses docker/docker-credential-helpers#133 docker-credential-pass commits about 10 times every time I run a docker command - docker/docker-credential-helpers#143 Fix docker-credential-osxkeychain list behaviour in case of missing entry in keychain - docker/docker-credential-helpers#139 make docker-credential-wincred work like docker-credential-osxkeychain Signed-off-by: Sebastiaan van Stijn (cherry picked from commit f6a4c76fbb6d594f4874dea5059e82eadfae867a) Signed-off-by: Sebastiaan van Stijn --- vendor.conf | 2 +- .../docker-credential-helpers/README.md | 2 +- .../credentials/version.go | 2 +- .../osxkeychain/osxkeychain_darwin.go | 46 ++++--------------- .../osxkeychain/url_go18.go | 13 ------ .../osxkeychain/url_non_go18.go | 41 ----------------- .../secretservice/secretservice_linux.go | 2 +- 7 files changed, 14 insertions(+), 94 deletions(-) delete mode 100644 vendor/github.com/docker/docker-credential-helpers/osxkeychain/url_go18.go delete mode 100644 vendor/github.com/docker/docker-credential-helpers/osxkeychain/url_non_go18.go diff --git a/vendor.conf b/vendor.conf index abec83309d..3d14051a6a 100755 --- a/vendor.conf +++ b/vendor.conf @@ -13,7 +13,7 @@ github.com/davecgh/go-spew 346938d642f2ec3594ed81d87446 github.com/dgrijalva/jwt-go a2c85815a77d0f951e33ba4db5ae93629a1530af github.com/docker/distribution 83389a148052d74ac602f5f1d62f86ff2f3c4aa5 github.com/docker/docker 200b524eff60a9c95a22bc2518042ac2ff617d07 https://github.com/docker/engine # 18.09 branch -github.com/docker/docker-credential-helpers 5241b46610f2491efdf9d1c85f1ddf5b02f6d962 +github.com/docker/docker-credential-helpers 8a9f93a99ff87f416cc79f267c68151af0026f60 # v0.6.2 github.com/docker/go d30aec9fd63c35133f8f79c3412ad91a3b08be06 # Contains a customized version of canonical/json and is used by Notary. The package is periodically rebased on current Go versions. github.com/docker/go-connections 7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0 github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9 diff --git a/vendor/github.com/docker/docker-credential-helpers/README.md b/vendor/github.com/docker/docker-credential-helpers/README.md index f9cbc3fb5f..c469c944bf 100644 --- a/vendor/github.com/docker/docker-credential-helpers/README.md +++ b/vendor/github.com/docker/docker-credential-helpers/README.md @@ -16,7 +16,7 @@ The programs in this repository are written with the Go programming language. Th $ go get github.com/docker/docker-credential-helpers ``` -2 - Use `make` to build the program you want. That will leave any executable in the `bin` directory inside the repository. +2 - Use `make` to build the program you want. That will leave an executable in the `bin` directory inside the repository. ``` $ cd $GOPATH/docker/docker-credentials-helpers diff --git a/vendor/github.com/docker/docker-credential-helpers/credentials/version.go b/vendor/github.com/docker/docker-credential-helpers/credentials/version.go index 033a5fee55..ecc23e68b9 100644 --- a/vendor/github.com/docker/docker-credential-helpers/credentials/version.go +++ b/vendor/github.com/docker/docker-credential-helpers/credentials/version.go @@ -1,4 +1,4 @@ package credentials // Version holds a string describing the current version -const Version = "0.6.0" +const Version = "0.6.2" diff --git a/vendor/github.com/docker/docker-credential-helpers/osxkeychain/osxkeychain_darwin.go b/vendor/github.com/docker/docker-credential-helpers/osxkeychain/osxkeychain_darwin.go index 439126761e..da57d00c41 100644 --- a/vendor/github.com/docker/docker-credential-helpers/osxkeychain/osxkeychain_darwin.go +++ b/vendor/github.com/docker/docker-credential-helpers/osxkeychain/osxkeychain_darwin.go @@ -1,8 +1,8 @@ package osxkeychain /* -#cgo CFLAGS: -x objective-c -mmacosx-version-min=10.10 -#cgo LDFLAGS: -framework Security -framework Foundation -mmacosx-version-min=10.10 +#cgo CFLAGS: -x objective-c -mmacosx-version-min=10.11 +#cgo LDFLAGS: -framework Security -framework Foundation -mmacosx-version-min=10.11 #include "osxkeychain_darwin.h" #include @@ -10,12 +10,11 @@ package osxkeychain import "C" import ( "errors" - "net/url" "strconv" - "strings" "unsafe" "github.com/docker/docker-credential-helpers/credentials" + "github.com/docker/docker-credential-helpers/registryurl" ) // errCredentialsNotFound is the specific error message returned by OS X @@ -113,6 +112,10 @@ func (h Osxkeychain) List() (map[string]string, error) { if errMsg != nil { defer C.free(unsafe.Pointer(errMsg)) goMsg := C.GoString(errMsg) + if goMsg == errCredentialsNotFound { + return make(map[string]string), nil + } + return nil, errors.New(goMsg) } @@ -135,7 +138,7 @@ func (h Osxkeychain) List() (map[string]string, error) { } func splitServer(serverURL string) (*C.struct_Server, error) { - u, err := parseURL(serverURL) + u, err := registryurl.Parse(serverURL) if err != nil { return nil, err } @@ -145,7 +148,7 @@ func splitServer(serverURL string) (*C.struct_Server, error) { proto = C.kSecProtocolTypeHTTP } var port int - p := getPort(u) + p := registryurl.GetPort(u) if p != "" { port, err = strconv.Atoi(p) if err != nil { @@ -155,7 +158,7 @@ func splitServer(serverURL string) (*C.struct_Server, error) { return &C.struct_Server{ proto: C.SecProtocolType(proto), - host: C.CString(getHostname(u)), + host: C.CString(registryurl.GetHostname(u)), port: C.uint(port), path: C.CString(u.Path), }, nil @@ -165,32 +168,3 @@ func freeServer(s *C.struct_Server) { C.free(unsafe.Pointer(s.host)) C.free(unsafe.Pointer(s.path)) } - -// parseURL parses and validates a given serverURL to an url.URL, and -// returns an error if validation failed. Querystring parameters are -// omitted in the resulting URL, because they are not used in the helper. -// -// If serverURL does not have a valid scheme, `//` is used as scheme -// before parsing. This prevents the hostname being used as path, -// and the credentials being stored without host. -func parseURL(serverURL string) (*url.URL, error) { - // Check if serverURL has a scheme, otherwise add `//` as scheme. - if !strings.Contains(serverURL, "://") && !strings.HasPrefix(serverURL, "//") { - serverURL = "//" + serverURL - } - - u, err := url.Parse(serverURL) - if err != nil { - return nil, err - } - - if u.Scheme != "" && u.Scheme != "https" && u.Scheme != "http" { - return nil, errors.New("unsupported scheme: " + u.Scheme) - } - if getHostname(u) == "" { - return nil, errors.New("no hostname in URL") - } - - u.RawQuery = "" - return u, nil -} diff --git a/vendor/github.com/docker/docker-credential-helpers/osxkeychain/url_go18.go b/vendor/github.com/docker/docker-credential-helpers/osxkeychain/url_go18.go deleted file mode 100644 index 0b7297d2fc..0000000000 --- a/vendor/github.com/docker/docker-credential-helpers/osxkeychain/url_go18.go +++ /dev/null @@ -1,13 +0,0 @@ -//+build go1.8 - -package osxkeychain - -import "net/url" - -func getHostname(u *url.URL) string { - return u.Hostname() -} - -func getPort(u *url.URL) string { - return u.Port() -} diff --git a/vendor/github.com/docker/docker-credential-helpers/osxkeychain/url_non_go18.go b/vendor/github.com/docker/docker-credential-helpers/osxkeychain/url_non_go18.go deleted file mode 100644 index bdf9b7b006..0000000000 --- a/vendor/github.com/docker/docker-credential-helpers/osxkeychain/url_non_go18.go +++ /dev/null @@ -1,41 +0,0 @@ -//+build !go1.8 - -package osxkeychain - -import ( - "net/url" - "strings" -) - -func getHostname(u *url.URL) string { - return stripPort(u.Host) -} - -func getPort(u *url.URL) string { - return portOnly(u.Host) -} - -func stripPort(hostport string) string { - colon := strings.IndexByte(hostport, ':') - if colon == -1 { - return hostport - } - if i := strings.IndexByte(hostport, ']'); i != -1 { - return strings.TrimPrefix(hostport[:i], "[") - } - return hostport[:colon] -} - -func portOnly(hostport string) string { - colon := strings.IndexByte(hostport, ':') - if colon == -1 { - return "" - } - if i := strings.Index(hostport, "]:"); i != -1 { - return hostport[i+len("]:"):] - } - if strings.Contains(hostport, "]") { - return "" - } - return hostport[colon+len(":"):] -} diff --git a/vendor/github.com/docker/docker-credential-helpers/secretservice/secretservice_linux.go b/vendor/github.com/docker/docker-credential-helpers/secretservice/secretservice_linux.go index 95a1310b65..383b0c2465 100644 --- a/vendor/github.com/docker/docker-credential-helpers/secretservice/secretservice_linux.go +++ b/vendor/github.com/docker/docker-credential-helpers/secretservice/secretservice_linux.go @@ -93,7 +93,7 @@ func (h Secretservice) List() (map[string]string, error) { var listLenC C.uint err := C.list(credsLabelC, &pathsC, &acctsC, &listLenC) if err != nil { - defer C.free(unsafe.Pointer(err)) + defer C.g_error_free(err) return nil, errors.New("Error from list function in secretservice_linux.c likely due to error in secretservice library") } defer C.freeListData(&pathsC, listLenC) From ea2b47419605fb05229448ba5caae07415ed0bea Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 16 Jul 2019 16:02:00 +0200 Subject: [PATCH 2/2] bump docker-credential-helpers v0.6.3 full diff: https://github.com/docker/docker-credential-helpers/compare/v0.6.2...v0.6.3 Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 64f0ae425284165c8f8866323782f1f4667b5f10) Signed-off-by: Sebastiaan van Stijn --- vendor.conf | 2 +- .../docker/docker-credential-helpers/credentials/version.go | 2 +- .../osxkeychain/osxkeychain_darwin.c | 1 - .../osxkeychain/osxkeychain_darwin.go | 5 ++--- .../secretservice/secretservice_linux.c | 1 - .../secretservice/secretservice_linux.go | 4 ++-- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/vendor.conf b/vendor.conf index 3d14051a6a..66153774a7 100755 --- a/vendor.conf +++ b/vendor.conf @@ -13,7 +13,7 @@ github.com/davecgh/go-spew 346938d642f2ec3594ed81d87446 github.com/dgrijalva/jwt-go a2c85815a77d0f951e33ba4db5ae93629a1530af github.com/docker/distribution 83389a148052d74ac602f5f1d62f86ff2f3c4aa5 github.com/docker/docker 200b524eff60a9c95a22bc2518042ac2ff617d07 https://github.com/docker/engine # 18.09 branch -github.com/docker/docker-credential-helpers 8a9f93a99ff87f416cc79f267c68151af0026f60 # v0.6.2 +github.com/docker/docker-credential-helpers 54f0238b6bf101fc3ad3b34114cb5520beb562f5 # v0.6.3 github.com/docker/go d30aec9fd63c35133f8f79c3412ad91a3b08be06 # Contains a customized version of canonical/json and is used by Notary. The package is periodically rebased on current Go versions. github.com/docker/go-connections 7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0 github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9 diff --git a/vendor/github.com/docker/docker-credential-helpers/credentials/version.go b/vendor/github.com/docker/docker-credential-helpers/credentials/version.go index ecc23e68b9..c2cc3e2e02 100644 --- a/vendor/github.com/docker/docker-credential-helpers/credentials/version.go +++ b/vendor/github.com/docker/docker-credential-helpers/credentials/version.go @@ -1,4 +1,4 @@ package credentials // Version holds a string describing the current version -const Version = "0.6.2" +const Version = "0.6.3" diff --git a/vendor/github.com/docker/docker-credential-helpers/osxkeychain/osxkeychain_darwin.c b/vendor/github.com/docker/docker-credential-helpers/osxkeychain/osxkeychain_darwin.c index f84d61ee5d..845012bd91 100644 --- a/vendor/github.com/docker/docker-credential-helpers/osxkeychain/osxkeychain_darwin.c +++ b/vendor/github.com/docker/docker-credential-helpers/osxkeychain/osxkeychain_darwin.c @@ -224,5 +224,4 @@ void freeListData(char *** data, unsigned int length) { for(int i=0; i