Skip to content

[Backport][main to 0.9] | test(net): build test certificates where the subject name comes back const (#1723) - #1724

Merged
lihuiba merged 2 commits into
release/0.9from
backport-pr-28d396e173b196c6b983d44db9e8b32ce1962385-0.9
Nov 2, 2026
Merged

lihuiba merged 2 commits into
release/0.9from
backport-pr-28d396e173b196c6b983d44db9e8b32ce1962385-0.9

Conversation

@photonlibos

@photonlibos photonlibos commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

test(net): build test certificates where the subject name comes back const (#1723)

  • test(net): take a writable subject name when building test certificates

The macOS arm image's X509_get_subject_name() returns a const X509_NAME*, while
X509_NAME_add_entry_by_txt() and X509_set_issuer_name() take a mutable one, so
client_function_test stopped compiling there -- the intel image's OpenSSL returns
the mutable pointer and was fine. The certificates are ours and writable, so the
five call sites go through one helper that takes the writable view back.

  • test(net): say why one const_cast covers both OpenSSL signatures

The getter's return qualifier follows whichever headers are installed, so the fix
must not key off a version: removing no qualifier is a no-op, which is what lets
the single helper compile unchanged against the mutable and the const signature.
Generated by Backport Auto PR, by cherry-pick related commits.

Please review and decide whether to merge or close this backport PR.

Conflicts (resolved)

Cherry-pick of 28d396e conflicted in net/security-context/test/test_cert_utils.h. Resolved in f0dba63:

Verified locally (aarch64, GCC 15, Debug): test-tls and client_tls_test build; test-tls passes 15/15, including ca_cert.verify_fail_wrong_ca, which exercises the changed code. client_tls_test aborts identically on unmodified release/0.9 in this environment (localhost resolves to ::1 while the server binds 127.0.0.1), so it is unrelated to this backport; CI is relied on for it.

…const (#1723)

* test(net): take a writable subject name when building test certificates

The macOS arm image's X509_get_subject_name() returns a const X509_NAME*, while
X509_NAME_add_entry_by_txt() and X509_set_issuer_name() take a mutable one, so
client_function_test stopped compiling there -- the intel image's OpenSSL returns
the mutable pointer and was fine. The certificates are ours and writable, so the
five call sites go through one helper that takes the writable view back.

* test(net): say why one const_cast covers both OpenSSL signatures

The getter's return qualifier follows whichever headers are installed, so the fix
must not key off a version: removing no qualifier is a no-op, which is what lets
the single helper compile unchanged against the mutable and the const signature.
@photonlibos photonlibos added need-backport A PR that should be back-ported to prior release branches (release/*) needs-manual-merge Auto-PR encounters conflicts and need to be fix manually. labels Nov 2, 2026
Drop the TestCertChain / generate_ca_signed_cert block that the cherry-pick
pulled in as conflict context: those helpers come from a main-only change and
nothing on release/0.9 uses them. What remains is the actual fix of #1723 --
test_subject_name() and its one call site in generate_different_self_signed_cert().
@Coldwings Coldwings removed the needs-manual-merge Auto-PR encounters conflicts and need to be fix manually. label Nov 2, 2026
@lihuiba
lihuiba marked this pull request as ready for review November 2, 2026 14:59
@lihuiba
lihuiba merged commit 83a16be into release/0.9 Nov 2, 2026
30 checks passed
@photonlibos
photonlibos deleted the backport-pr-28d396e173b196c6b983d44db9e8b32ce1962385-0.9 branch November 2, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

need-backport A PR that should be back-ported to prior release branches (release/*)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants