forked from TrueCloudLab/certificates
Fix code style issue
This commit is contained in:
parent
bc0875bd7b
commit
80bebda69c
1 changed files with 5 additions and 9 deletions
|
@ -300,19 +300,15 @@ func canonicalize(csr *x509.CertificateRequest) (canonicalized *x509.Certificate
|
||||||
// If these were excluded, a certificate could contain an IP as the
|
// If these were excluded, a certificate could contain an IP as the
|
||||||
// common name without having been challenged.
|
// common name without having been challenged.
|
||||||
if csr.Subject.CommonName != "" {
|
if csr.Subject.CommonName != "" {
|
||||||
ip := net.ParseIP(csr.Subject.CommonName)
|
if ip := net.ParseIP(csr.Subject.CommonName); ip != nil {
|
||||||
subjectIsIP := ip != nil
|
canonicalized.IPAddresses = append(canonicalized.IPAddresses, ip)
|
||||||
if subjectIsIP {
|
|
||||||
// nolint:gocritic
|
|
||||||
canonicalized.IPAddresses = append(csr.IPAddresses, ip)
|
|
||||||
} else {
|
} else {
|
||||||
// nolint:gocritic
|
canonicalized.DNSNames = append(canonicalized.DNSNames, csr.Subject.CommonName)
|
||||||
canonicalized.DNSNames = append(csr.DNSNames, csr.Subject.CommonName)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
canonicalized.DNSNames = uniqueSortedLowerNames(csr.DNSNames)
|
canonicalized.DNSNames = uniqueSortedLowerNames(canonicalized.DNSNames)
|
||||||
canonicalized.IPAddresses = uniqueSortedIPs(csr.IPAddresses)
|
canonicalized.IPAddresses = uniqueSortedIPs(canonicalized.IPAddresses)
|
||||||
|
|
||||||
return canonicalized
|
return canonicalized
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue