Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix updateEntry for first domain len > 64 #164

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pkg/cert/source/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,13 @@ func (r *sourceReconciler) updateEntry(logger logger.LogContext, info CertInfo,
var cn *string
var dnsNames []string
if len(info.Domains) > 0 {
cn = &info.Domains[0]
dnsNames = info.Domains[1:]
if len(info.Domains[0]) <= 64 {
cn = &info.Domains[0]
dnsNames = info.Domains[1:]
} else {
cn = nil
dnsNames = info.Domains
}
}

mod.AssureStringPtrPtr(&spec.CommonName, cn)
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/issuer/certificate/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,10 +771,10 @@ func (r *certReconciler) buildSpecNewHash(spec *api.CertificateSpec, issuerKey u
if spec.CommonName != nil {
h.Write([]byte(*spec.CommonName))
h.Write([]byte{0})
for _, domain := range spec.DNSNames {
h.Write([]byte(domain))
h.Write([]byte{0})
}
}
for _, domain := range spec.DNSNames {
h.Write([]byte(domain))
h.Write([]byte{0})
}
if spec.CSR != nil {
h.Write([]byte{0})
Expand Down