anmolnar commented on code in PR #2336:
URL: https://github.com/apache/zookeeper/pull/2336#discussion_r3081630121
##########
zookeeper-server/src/main/java/org/apache/zookeeper/util/PemReader.java:
##########
@@ -92,9 +92,13 @@ public static KeyStore loadTrustStore(File
certificateChainFile) throws IOExcept
keyStore.load(null, null);
List<X509Certificate> certificateChain =
readCertificateChain(certificateChainFile);
+ int i = 2;
Review Comment:
I think you can start with "-1"
##########
zookeeper-server/src/main/java/org/apache/zookeeper/util/PemReader.java:
##########
@@ -92,9 +92,13 @@ public static KeyStore loadTrustStore(File
certificateChainFile) throws IOExcept
keyStore.load(null, null);
List<X509Certificate> certificateChain =
readCertificateChain(certificateChainFile);
+ int i = 2;
for (X509Certificate certificate : certificateChain) {
X500Principal principal = certificate.getSubjectX500Principal();
- keyStore.setCertificateEntry(principal.getName("RFC2253"),
certificate);
+ // Append a suffix if the same alias (subject) already exists.
Review Comment:
nit: the comment should be moved one line below
##########
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:
Just checked the code. We would need to track the duplicated strings for
proper counting. Leave it as is for now.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]