You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by "anmolnar (via GitHub)" <gi...@apache.org> on 2026/01/09 21:09:32 UTC
Re: [PR] ZOOKEEPER-4992: Avoid overriding same-subject certs in PEM trust store [zookeeper]
anmolnar commented on code in PR #2336:
URL: https://github.com/apache/zookeeper/pull/2336#discussion_r2677629918
##########
zookeeper-server/src/main/java/org/apache/zookeeper/util/PemReader.java:
##########
@@ -92,9 +92,10 @@ public static KeyStore loadTrustStore(File certificateChainFile) throws IOExcept
keyStore.load(null, null);
List<X509Certificate> certificateChain = readCertificateChain(certificateChainFile);
+ int i = 1;
for (X509Certificate certificate : certificateChain) {
X500Principal principal = certificate.getSubjectX500Principal();
- keyStore.setCertificateEntry(principal.getName("RFC2253"), certificate);
+ keyStore.setCertificateEntry(principal.getName("RFC2253") + "-" + i++, certificate);
Review Comment:
Shall we check the name already exists first and add the suffix only when it's necessary?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org