summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-01-23 12:16:09 +0100
committerGitHub <noreply@github.com>2021-01-23 12:16:09 +0100
commit6cef7c78dd5f8e2e8e1fe91bd2c7d1298f7e4df9 (patch)
treebaacbe285948be9ad26d141940d40a31fed46f30 /pkg
parent1305f7c47a4c324c3afd873a244fe2315249a25d (diff)
parentc9baa6b93b38b96b2b85bfb732c3677f31574ba1 (diff)
downloadpodman-6cef7c78dd5f8e2e8e1fe91bd2c7d1298f7e4df9.tar.gz
podman-6cef7c78dd5f8e2e8e1fe91bd2c7d1298f7e4df9.tar.bz2
podman-6cef7c78dd5f8e2e8e1fe91bd2c7d1298f7e4df9.zip
Merge pull request #9028 from mlegenovic/master
Accept and ignore 'null' as value for X-Registry-Auth
Diffstat (limited to 'pkg')
-rw-r--r--pkg/auth/auth.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/auth/auth.go b/pkg/auth/auth.go
index fcbf6fe39..86d92c028 100644
--- a/pkg/auth/auth.go
+++ b/pkg/auth/auth.go
@@ -297,7 +297,9 @@ func imageAuthToDockerAuth(authConfig types.DockerAuthConfig) dockerAPITypes.Aut
func singleAuthHeader(r *http.Request) (map[string]types.DockerAuthConfig, error) {
authHeader := r.Header.Get(string(XRegistryAuthHeader))
authConfig := dockerAPITypes.AuthConfig{}
- if len(authHeader) > 0 {
+ // Accept "null" and handle it as empty value for compatibility reason with Docker.
+ // Some java docker clients pass this value, e.g. this one used in Eclipse.
+ if len(authHeader) > 0 && authHeader != "null" {
authJSON := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authHeader))
if err := json.NewDecoder(authJSON).Decode(&authConfig); err != nil {
return nil, err
@@ -312,7 +314,9 @@ func singleAuthHeader(r *http.Request) (map[string]types.DockerAuthConfig, error
// The header content is a map[string]DockerAuthConfigs.
func multiAuthHeader(r *http.Request) (map[string]types.DockerAuthConfig, error) {
authHeader := r.Header.Get(string(XRegistryAuthHeader))
- if len(authHeader) == 0 {
+ // Accept "null" and handle it as empty value for compatibility reason with Docker.
+ // Some java docker clients pass this value, e.g. this one used in Eclipse.
+ if len(authHeader) == 0 || authHeader == "null" {
return nil, nil
}