You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2021/12/12 00:01:16 UTC

[logging-log4j2] branch release-2.x updated: Test IPV6

This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/release-2.x by this push:
     new 66ec6a5  Test IPV6
66ec6a5 is described below

commit 66ec6a5e60c1b2c4e22c653fd7226ae33b15d615
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Sat Dec 11 17:01:06 2021 -0700

    Test IPV6
---
 .../core/lookup/JndiRestrictedLookupTest.java      | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/lookup/JndiRestrictedLookupTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/lookup/JndiRestrictedLookupTest.java
index 11cfc06..017477a 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/lookup/JndiRestrictedLookupTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/lookup/JndiRestrictedLookupTest.java
@@ -39,6 +39,8 @@ import static org.junit.Assert.fail;
 public class JndiRestrictedLookupTest {
 
     private static final String LDAP_URL = "ldap://127.0.0.1:";
+    private static final String LDAP_BADV6_URL = "ldap://[2001:db8:1f70::999:de8:7648:6e8]@127.0.0.1:";
+    private static final String LDAP_V6_URL = "ldap://[2001:db8:1f70::999:de8:7648:6e8]:";
     private static final String RESOURCE = "JndiExploit";
     private static final String TEST_STRING = "TestString";
     private static final String TEST_MESSAGE = "TestMessage";
@@ -71,6 +73,30 @@ public class JndiRestrictedLookupTest {
     }
 
     @Test
+    public void testBadV6Lookup() throws Exception {
+        int port = embeddedLdapRule.embeddedServerPort();
+        Context context = embeddedLdapRule.context();
+        context.bind(   "cn=" + RESOURCE +"," + DOMAIN_DSN, new Fruit("Test Message"));
+        final StrLookup lookup = new JndiLookup();
+        String result = lookup.lookup(LDAP_BADV6_URL + port + "/" + "cn=" + RESOURCE + "," + DOMAIN_DSN);
+        if (result != null) {
+            fail("Lookup returned an object");
+        }
+    }
+
+    @Test
+    public void testV6Lookup() throws Exception {
+        int port = embeddedLdapRule.embeddedServerPort();
+        Context context = embeddedLdapRule.context();
+        context.bind(   "cn=" + RESOURCE +"," + DOMAIN_DSN, new Fruit("Test Message"));
+        final StrLookup lookup = new JndiLookup();
+        String result = lookup.lookup(LDAP_V6_URL + port + "/" + "cn=" + RESOURCE + "," + DOMAIN_DSN);
+        if (result != null) {
+            fail("Lookup returned an object");
+        }
+    }
+
+    @Test
     public void testReferenceLookup() throws Exception {
         int port = embeddedLdapRule.embeddedServerPort();
         Context context = embeddedLdapRule.context();