You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2019/06/07 16:40:11 UTC

[accumulo] branch 1.9 updated: Ensures correct use of ZooKeeper getAcl (#1185)

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

ctubbsii pushed a commit to branch 1.9
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/1.9 by this push:
     new 3311218  Ensures correct use of ZooKeeper getAcl (#1185)
3311218 is described below

commit 3311218c639173f1df41fa31b318e17a1e0ce47f
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Fri Jun 7 12:40:06 2019 -0400

    Ensures correct use of ZooKeeper getAcl (#1185)
    
    This fixes a bug in Accumulo where we were using an unauthenticated
    ZooKeeper session to read ACLs on a node that we had previously written.
    
    ZooKeeper 3.4.14 fixed a bug in their code that allowed unauthenticated
    connections to read ACLs on paths for which they did not have READ
    permission.
    
    Using Accumulo with that version of ZooKeeper exposed the bug in our
    code that passed the incorrect ZooKeeper session when retrieving ACLs.
---
 fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooReader.java | 5 +----
 fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java   | 4 ++--
 pom.xml                                                              | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooReader.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooReader.java
index 3bd470f..24a2bc8 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooReader.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooReader.java
@@ -22,7 +22,6 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.accumulo.fate.util.Retry;
 import org.apache.accumulo.fate.util.Retry.RetryFactory;
-import org.apache.accumulo.fate.zookeeper.ZooUtil.ZooKeeperConnectionInfo;
 import org.apache.zookeeper.AsyncCallback.VoidCallback;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.KeeperException.Code;
@@ -39,7 +38,6 @@ public class ZooReader implements IZooReader {
   protected String keepers;
   protected int timeout;
   private final RetryFactory retryFactory;
-  private final ZooKeeperConnectionInfo info;
 
   protected ZooKeeper getSession(String keepers, int timeout, String scheme, byte[] auth) {
     return ZooSession.getSession(keepers, timeout, scheme, auth);
@@ -255,13 +253,12 @@ public class ZooReader implements IZooReader {
 
   @Override
   public List<ACL> getACL(String zPath, Stat stat) throws KeeperException, InterruptedException {
-    return ZooUtil.getACL(info, zPath, stat);
+    return ZooUtil.getACL(getZooKeeper(), zPath, stat);
   }
 
   public ZooReader(String keepers, int timeout) {
     this.keepers = keepers;
     this.timeout = timeout;
     this.retryFactory = ZooUtil.DEFAULT_RETRY;
-    this.info = new ZooKeeperConnectionInfo(keepers, timeout, null, null);
   }
 }
diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java
index bbd4611..a61d668 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java
@@ -545,12 +545,12 @@ public class ZooUtil {
     }
   }
 
-  public static List<ACL> getACL(ZooKeeperConnectionInfo info, String zPath, Stat stat)
+  public static List<ACL> getACL(ZooKeeper zk, String zPath, Stat stat)
       throws KeeperException, InterruptedException {
     final Retry retry = RETRY_FACTORY.createRetry();
     while (true) {
       try {
-        return getZooKeeper(info).getACL(zPath, stat);
+        return zk.getACL(zPath, stat);
       } catch (KeeperException e) {
         final Code c = e.code();
         if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
diff --git a/pom.xml b/pom.xml
index 1ef5233..e5f2e2b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -149,7 +149,7 @@
     <!-- Thrift version -->
     <thrift.version>0.9.3-1</thrift.version>
     <!-- ZooKeeper version -->
-    <zookeeper.version>3.4.6</zookeeper.version>
+    <zookeeper.version>3.4.14</zookeeper.version>
   </properties>
   <dependencyManagement>
     <dependencies>