mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
Merge pull request #361 from akerouanton/fix-regressions-v0.9.0
[v0.9.0] osxkeychain: fix regressions on get and list
This commit is contained in:
@@ -117,8 +117,6 @@ func (h Osxkeychain) List() (map[string]string, error) {
|
|||||||
default:
|
default:
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
} else if len(res) == 0 {
|
|
||||||
return nil, credentials.NewErrCredentialsNotFound()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := make(map[string]string)
|
resp := make(map[string]string)
|
||||||
@@ -131,14 +129,22 @@ func (h Osxkeychain) List() (map[string]string, error) {
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Hardcoded protocol types matching their Objective-C equivalents.
|
||||||
|
// https://developer.apple.com/documentation/security/ksecattrprotocolhttps?language=objc
|
||||||
|
kSecProtocolTypeHTTPS = "htps" // This is NOT a typo.
|
||||||
|
// https://developer.apple.com/documentation/security/ksecattrprotocolhttp?language=objc
|
||||||
|
kSecProtocolTypeHTTP = "http"
|
||||||
|
)
|
||||||
|
|
||||||
func splitServer(serverURL string, item keychain.Item) error {
|
func splitServer(serverURL string, item keychain.Item) error {
|
||||||
u, err := registryurl.Parse(serverURL)
|
u, err := registryurl.Parse(serverURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
item.SetProtocol("https")
|
item.SetProtocol(kSecProtocolTypeHTTPS)
|
||||||
if u.Scheme == "http" {
|
if u.Scheme == "http" {
|
||||||
item.SetProtocol("http")
|
item.SetProtocol(kSecProtocolTypeHTTP)
|
||||||
}
|
}
|
||||||
item.SetServer(u.Hostname())
|
item.SetServer(u.Hostname())
|
||||||
if p := u.Port(); p != "" {
|
if p := u.Port(); p != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user