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

This commit is contained in:
cnauroth 2015-10-22 15:25:10 -07:00
parent 513ec3de19
commit 124a412a37
5 changed files with 11 additions and 5 deletions

View File

@ -1025,7 +1025,7 @@ public static class FSRemoveAclEntries implements FileSystemAccess.FileSystemExe
*/ */
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 @@ private void testFileAcls() 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 aclSet = "user::rwx," + aclUser1 + "," final String aclSet = "user::rwx," + aclUser1 + ","
@ -765,7 +766,7 @@ private void testFileAcls() throws Exception {
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 static String setXAttrParam(String name, byte[] value) throws IOException
@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 @@ private void putCmd(String filename, String command,
@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";

View File

@ -2114,6 +2114,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