Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Vault
Commits
849bf65f
Unverified
Commit
849bf65f
authored
4 years ago
by
Nick Cabatoff
Committed by
GitHub
4 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Don't list certs if we were told which cert to use. (#10616)
parent
654c9ea2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
builtin/credential/cert/path_login.go
+18
-8
builtin/credential/cert/path_login.go
with
18 additions
and
8 deletions
+18
-8
builtin/credential/cert/path_login.go
+
18
-
8
View file @
849bf65f
...
...
@@ -414,21 +414,31 @@ func (b *backend) loadTrustedCerts(ctx context.Context, storage logical.Storage,
pool
=
x509
.
NewCertPool
()
trusted
=
make
([]
*
ParsedCert
,
0
)
trustedNonCAs
=
make
([]
*
ParsedCert
,
0
)
names
,
err
:=
storage
.
List
(
ctx
,
"cert/"
)
if
err
!=
nil
{
b
.
Logger
()
.
Error
(
"failed to list trusted certs"
,
"error"
,
err
)
return
var
names
[]
string
if
certName
!=
""
{
names
=
append
(
names
,
certName
)
}
else
{
var
err
error
names
,
err
=
storage
.
List
(
ctx
,
"cert/"
)
if
err
!=
nil
{
b
.
Logger
()
.
Error
(
"failed to list trusted certs"
,
"error"
,
err
)
return
}
}
for
_
,
name
:=
range
names
{
// If we are trying to select a single CertEntry and this isn't it
if
certName
!=
""
&&
name
!=
certName
{
continue
}
entry
,
err
:=
b
.
Cert
(
ctx
,
storage
,
strings
.
TrimPrefix
(
name
,
"cert/"
))
if
err
!=
nil
{
b
.
Logger
()
.
Error
(
"failed to load trusted cert"
,
"name"
,
name
,
"error"
,
err
)
continue
}
if
entry
==
nil
{
// This could happen when the certName was provided and the cert doesn't exist,
// or just if between the LIST and the GET the cert was deleted.
continue
}
parsed
:=
parsePEM
([]
byte
(
entry
.
Certificate
))
if
len
(
parsed
)
==
0
{
b
.
Logger
()
.
Error
(
"failed to parse certificate"
,
"name"
,
name
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment