Repository navigation
test(net): build test certificates where the subject name comes back const - #1723
Merged
Merged
Conversation
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.
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.
Coldwings
approved these changes
Nov 2, 2026
Coldwings
added a commit
that referenced
this pull request
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().
lihuiba
added a commit
that referenced
this pull request
Nov 2, 2026
…e subject name comes back const (#1723) (#1724) * 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. * test(net): resolve backport conflict in test_cert_utils.h 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(). --------- Co-authored-by: Huiba Li <huiba.lhb@alibaba-inc.com> Co-authored-by: Coldwings <coldwings@me.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
net/security-context/test/test_cert_utils.hhands the result ofX509_get_subject_name()toX509_NAME_add_entry_by_txt()andX509_set_issuer_name(), which take a mutableX509_NAME*. The getter's returnqualifier depends on the OpenSSL headers in use: 1.1.1 returns
X509_NAME*,newer ones return
const X509_NAME*. With the newer headers the five call sitesfail to compile:
This is what broke the macOS arm CI image (whose homebrew OpenSSL is newer) while
the intel image, on 1.1.1, stayed green -- same source, two header versions.
How
One helper takes the writable view back, and the five sites use it:
No version macro: on the old signature
const_castremoves no qualifier and is ano-op, so the same text compiles against both. The cast is sound because these
certificates are built here and are writable.
Verification
-fsyntax-onlyonnet/http/test/client_function_test.cppwith OpenSSL 3.6.3headers: clean.
const) in one TU: compiles in both directions.
macOS intel job cover the mutable one.