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

(cherry picked from commit 124a412a37)
This commit is contained in:
cnauroth 2015-10-22 15:25:10 -07:00
parent 525a67a62e
commit 4ee8297c89
5 changed files with 11 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -1282,6 +1282,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9273. ACLs on root directory may be lost after NN restart. HDFS-9273. ACLs on root directory may be lost after NN restart.
(Xiao Chen via cnauroth) (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 Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES