mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-28 04:10:44 -04:00
auth/cert: Guard against empty certs. Fixes #214
This commit is contained in:
parent
45f14256fe
commit
cce15445c9
1 changed files with 7 additions and 2 deletions
|
|
@ -154,9 +154,14 @@ func validateConnState(roots *x509.CertPool, cs *tls.ConnectionState) ([][]*x509
|
|||
KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageAny},
|
||||
}
|
||||
certs := cs.PeerCertificates
|
||||
if len(certs) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
for _, cert := range certs[1:] {
|
||||
opts.Intermediates.AddCert(cert)
|
||||
if len(certs) > 1 {
|
||||
for _, cert := range certs[1:] {
|
||||
opts.Intermediates.AddCert(cert)
|
||||
}
|
||||
}
|
||||
|
||||
chains, err := certs[0].Verify(opts)
|
||||
|
|
|
|||
Loading…
Reference in a new issue