From b5818034eb4cf6bc3f8bb5fef1ac44e8f4cf5986 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 30 Apr 2015 13:51:27 +1000 Subject: [PATCH] 465734 DosFilter whitelist bit pattern fix removed conflicting setter --- .../org/eclipse/jetty/servlets/DoSFilter.java | 18 +++--------------- .../eclipse/jetty/servlets/DoSFilterTest.java | 2 +- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java index ad758b18bf5..f1e331591af 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java @@ -1031,29 +1031,17 @@ public class DoSFilter implements Filter /** * Set a list of IP addresses that will not be rate limited. * - * @param value comma-separated whitelist + * @param commaSeparatedList comma-separated whitelist */ - public void setWhitelist(String value) + public void setWhitelist(String commaSeparatedList) { List result = new ArrayList<>(); - for (String address : value.split(",")) + for (String address : commaSeparatedList.split(",")) addWhitelistAddress(result, address); clearWhitelist(); _whitelist.addAll(result); LOG.debug("Whitelisted IP addresses: {}", result); } - - /** - * Set a list of IP addresses that will not be rate limited. - * - * @param values whitelist - */ - public void setWhitelist(List values) - { - clearWhitelist(); - _whitelist.addAll(values); - LOG.debug("Whitelisted IP addresses: {}", values); - } /** * Clears the list of whitelisted IP addresses diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/DoSFilterTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/DoSFilterTest.java index 93177e90250..35001a20272 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/DoSFilterTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/DoSFilterTest.java @@ -82,7 +82,7 @@ public class DoSFilterTest extends AbstractDoSFilterTest whitelist.add("10.0.0.0/8"); whitelist.add("4d8:0:a:1234:ABc:1F:b18:17"); whitelist.add("4d8:0:a:1234:ABc:1F:0:0/96"); - filter.setWhitelist(whitelist); + filter.setWhitelist("192.168.0.1/32,10.0.0.0/8,4d8:0:a:1234:ABc:1F:b18:17,4d8:0:a:1234:ABc:1F:0:0/96"); Assert.assertTrue(filter.checkWhitelist("192.168.0.1")); Assert.assertFalse(filter.checkWhitelist("192.168.0.2")); Assert.assertFalse(filter.checkWhitelist("11.12.13.14"));