diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2017-01-29 23:33:27 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2017-01-29 23:33:27 +0100 |
commit | cbfd3edbea5217fba5fd189aba33261e4510bd7d (patch) | |
tree | c3c3e7217387d69e9a8cc792baa469c40f422911 /zkfacade/src/main | |
parent | b69c1cad6dae7506c22e13ceb2432d8f1839ab4d (diff) |
Split vespa_zkfacade__restrict on space too
Diffstat (limited to 'zkfacade/src/main')
-rw-r--r-- | zkfacade/src/main/java/com/yahoo/vespa/zookeeper/RestrictedServerCnxnFactory.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/zkfacade/src/main/java/com/yahoo/vespa/zookeeper/RestrictedServerCnxnFactory.java b/zkfacade/src/main/java/com/yahoo/vespa/zookeeper/RestrictedServerCnxnFactory.java index bababa9a25c..972cf577ab3 100644 --- a/zkfacade/src/main/java/com/yahoo/vespa/zookeeper/RestrictedServerCnxnFactory.java +++ b/zkfacade/src/main/java/com/yahoo/vespa/zookeeper/RestrictedServerCnxnFactory.java @@ -2,6 +2,7 @@ package com.yahoo.vespa.zookeeper; import com.google.common.collect.ImmutableSet; import com.yahoo.net.HostName; +import com.yahoo.text.StringUtilities; import org.apache.zookeeper.server.NIOServerCnxn; import org.apache.zookeeper.server.NIOServerCnxnFactory; @@ -58,7 +59,9 @@ public class RestrictedServerCnxnFactory extends NIOServerCnxnFactory { /** Returns the allowed client host names. If the list is empty any host is allowed. */ private ImmutableSet<String> findAllowedZooKeeperClients() { - // Environment has precedence. Note that this allows setting restrict to "" to turn off client restriction + // Environment has precedence. Note that + // - if this is set to "", client restriction is disabled + // - this environment variable is a public API - do not change String environmentAllowedZooKeeperClients = System.getenv("vespa_zkfacade__restrict"); if (environmentAllowedZooKeeperClients != null) return ImmutableSet.copyOf(toHostnameSet(environmentAllowedZooKeeperClients)); @@ -67,9 +70,9 @@ public class RestrictedServerCnxnFactory extends NIOServerCnxnFactory { return ZooKeeperServer.getAllowedClientHostnames(); } - private Set<String> toHostnameSet(String commaSeparatedString) { + private Set<String> toHostnameSet(String hosatnamesString) { Set<String> hostnames = new HashSet<>(); - for (String hostname : commaSeparatedString.split(",")) { + for (String hostname : StringUtilities.split(hosatnamesString)) { if ( ! hostname.trim().isEmpty()) hostnames.add(hostname.trim()); } |