fix: preferred chain only match root name (#1334)

This commit is contained in:
Ludovic Fernandez 2021-01-28 20:26:07 +01:00 committed by GitHub
parent 6d068b5269
commit 1d24006e69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -540,10 +540,10 @@ func hasPreferredChain(issuer []byte, preferredChain string) (bool, error) {
return false, err return false, err
} }
for _, cert := range certs { topCert := certs[len(certs)-1]
if cert.Issuer.CommonName == preferredChain {
return true, nil if topCert.Issuer.CommonName == preferredChain {
} return true, nil
} }
return false, nil return false, nil