1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-28 15:21:29 +05:30

Compare commits

..

4 Commits

Author SHA1 Message Date
Paweł Gronowski ca5e83c83a Merge pull request #228 from thaJeztah/carry_openbsd_secretservice
secretservice: allow building on openbsd
2026-04-20 13:02:07 +02:00
Paweł Gronowski 7cd63786cf Merge pull request #428 from thaJeztah/wincred_cleanups
wincred: minor cleanups
2026-04-20 13:01:57 +02:00
Rafael Ávila de Espíndola 5fcff353e7 secretservice: allow building on openbsd
There is nothing linux specific about secretservice. I was able to
build it on openbsd with this change.

Signed-off-by: Rafael Ávila de Espíndola <rafael@espindo.la>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-04-20 12:56:55 +02:00
Sebastiaan van Stijn 390d43e7e4 wincred: minor cleanups
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-04-20 11:48:16 +02:00
3 changed files with 11 additions and 17 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
//go:build linux && cgo //go:build (linux || openbsd) && cgo
package secretservice package secretservice
+1 -1
View File
@@ -1,4 +1,4 @@
//go:build linux && cgo //go:build (linux || openbsd) && cgo
package secretservice package secretservice
+9 -15
View File
@@ -5,7 +5,6 @@ package wincred
import ( import (
"bytes" "bytes"
"net/url" "net/url"
"strings"
winc "github.com/danieljoos/wincred" winc "github.com/danieljoos/wincred"
"github.com/docker/docker-credential-helpers/credentials" "github.com/docker/docker-credential-helpers/credentials"
@@ -54,9 +53,7 @@ func (h Wincred) Get(serverURL string) (string, string, error) {
} }
for _, attr := range g.Attributes { for _, attr := range g.Attributes {
if strings.Compare(attr.Keyword, "label") == 0 && if attr.Keyword == "label" && bytes.Equal(attr.Value, []byte(credentials.CredsLabel)) {
bytes.Compare(attr.Value, []byte(credentials.CredsLabel)) == 0 {
return g.UserName, string(g.CredentialBlob), nil return g.UserName, string(g.CredentialBlob), nil
} }
} }
@@ -75,11 +72,10 @@ func getTarget(serverURL string) (string, error) {
} }
var targets []string var targets []string
for i := range creds { for _, cred := range creds {
attrs := creds[i].Attributes for _, attr := range cred.Attributes {
for _, attr := range attrs {
if attr.Keyword == "label" && bytes.Equal(attr.Value, []byte(credentials.CredsLabel)) { if attr.Keyword == "label" && bytes.Equal(attr.Value, []byte(credentials.CredsLabel)) {
targets = append(targets, creds[i].TargetName) targets = append(targets, cred.TargetName)
} }
} }
} }
@@ -136,16 +132,14 @@ func (h Wincred) List() (map[string]string, error) {
} }
resp := make(map[string]string) resp := make(map[string]string)
for i := range creds {
attrs := creds[i].Attributes
for _, attr := range attrs {
if strings.Compare(attr.Keyword, "label") == 0 &&
bytes.Compare(attr.Value, []byte(credentials.CredsLabel)) == 0 {
resp[creds[i].TargetName] = creds[i].UserName for _, cred := range creds {
for _, attr := range cred.Attributes {
if attr.Keyword == "label" && bytes.Equal(attr.Value, []byte(credentials.CredsLabel)) {
resp[cred.TargetName] = cred.UserName
break
} }
} }
} }
return resp, nil return resp, nil