Selaa lähdekoodia

HDFS-9286. HttpFs does not parse ACL syntax correctly for operation REMOVEACLENTRIES. Contributed by Wei-Chiu Chuang.

cnauroth 9 vuotta sitten
vanhempi
commit
124a412a37

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java

@@ -1025,7 +1025,7 @@ public class FSOperations {
      */
     public FSRemoveAclEntries(String path, String aclSpec) {
       this.path = new Path(path);
-      this.aclEntries = AclEntry.parseAclSpec(aclSpec, true);
+      this.aclEntries = AclEntry.parseAclSpec(aclSpec, false);
     }
 
     /**

+ 2 - 1
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/fs/http/client/BaseTestHttpFSWith.java

@@ -738,6 +738,7 @@ public abstract class BaseTestHttpFSWith extends HFSTestCase {
     }
 
     final String aclUser1 = "user:foo:rw-";
+    final String rmAclUser1 = "user:foo:";
     final String aclUser2 = "user:bar:r--";
     final String aclGroup1 = "group::r--";
     final String aclSet = "user::rwx," + aclUser1 + ","
@@ -765,7 +766,7 @@ public abstract class BaseTestHttpFSWith extends HFSTestCase {
     httpfsAclStat = httpfs.getAclStatus(path);
     assertSameAcls(httpfsAclStat, proxyAclStat);
 
-    httpfs.removeAclEntries(path, AclEntry.parseAclSpec(aclUser1, true));
+    httpfs.removeAclEntries(path, AclEntry.parseAclSpec(rmAclUser1, false));
     proxyAclStat = proxyFs.getAclStatus(path);
     httpfsAclStat = httpfs.getAclStatus(path);
     assertSameAcls(httpfsAclStat, proxyAclStat);

+ 2 - 1
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/fs/http/server/TestHttpFSServer.java

@@ -501,12 +501,13 @@ public class TestHttpFSServer extends HFSTestCase {
   @TestHdfs
   public void testFileAcls() throws Exception {
     final String aclUser1 = "user:foo:rw-";
+    final String remAclUser1 = "user:foo:";
     final String aclUser2 = "user:bar:r--";
     final String aclGroup1 = "group::r--";
     final String aclSpec = "aclspec=user::rwx," + aclUser1 + ","
             + aclGroup1 + ",other::---";
     final String modAclSpec = "aclspec=" + aclUser2;
-    final String remAclSpec = "aclspec=" + aclUser1;
+    final String remAclSpec = "aclspec=" + remAclUser1;
     final String dir = "/aclFileTest";
     final String path = dir + "/test";
     String statusJson;

+ 3 - 2
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/fs/http/server/TestHttpFSServerNoACLs.java

@@ -243,12 +243,13 @@ public class TestHttpFSServerNoACLs extends HTestCase {
   @TestJetty
   public void testWithNoAcls() throws Exception {
     final String aclUser1 = "user:foo:rw-";
+    final String rmAclUser1 = "user:foo:";
     final String aclUser2 = "user:bar:r--";
     final String aclGroup1 = "group::r--";
     final String aclSpec = "aclspec=user::rwx," + aclUser1 + ","
             + aclGroup1 + ",other::---";
     final String modAclSpec = "aclspec=" + aclUser2;
-    final String remAclSpec = "aclspec=" + aclUser1;
+    final String remAclSpec = "aclspec=" + rmAclUser1;
     final String defUser1 = "default:user:glarch:r-x";
     final String defSpec1 = "aclspec=" + defUser1;
     final String dir = "/noACLs";
@@ -278,4 +279,4 @@ public class TestHttpFSServerNoACLs extends HTestCase {
 
     miniDfs.shutdown();
   }
-}
+}

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -2114,6 +2114,9 @@ Release 2.8.0 - UNRELEASED
     HDFS-9273. ACLs on root directory may be lost after NN restart.
     (Xiao Chen via cnauroth)
 
+    HDFS-9286. HttpFs does not parse ACL syntax correctly for operation
+    REMOVEACLENTRIES. (Wei-Chiu Chuang via cnauroth)
+
 Release 2.7.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES