symat commented on a change in pull request #1353:
URL: https://github.com/apache/zookeeper/pull/1353#discussion_r427058447



##########
File path: 
zookeeper-server/src/main/java/org/apache/zookeeper/common/ZKHostnameVerifier.java
##########
@@ -324,8 +324,14 @@ private static HostNameType determineHostFormat(final 
String host) {
             for (List<?> entry : entries) {
                 final Integer type = entry.size() >= 2 ? (Integer) 
entry.get(0) : null;
                 if (type != null) {
-                    final String s = (String) entry.get(1);
-                    result.add(new SubjectName(s, type));
+                    if (type == SubjectName.DNS || type == SubjectName.IP) {
+                        final Object o = entry.get(1);
+                        if (o instanceof String) {
+                            result.add(new SubjectName((String) o, type));
+                        } else if (o instanceof byte[]) {
+                            // TODO ASN.1 DER encoded form

Review comment:
       I am not sure what ASN.1 DER is or how commonly it is used, but I think 
at least printing out a warning here would make sense (informing the user that 
ASN.1 DER is not supported). (?)

##########
File path: 
zookeeper-server/src/test/java/org/apache/zookeeper/common/ZKHostnameVerifierTest.java
##########
@@ -0,0 +1,158 @@
+/**

Review comment:
       this is a great test to have, thanks!




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to