HDFS-3581. FSPermissionChecker#checkPermission sticky bit check missing range check. Contributed by Eli Collins

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1356972 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-07-03 21:43:48 +00:00
parent 0929846101
commit d222e91bfa
3 changed files with 8 additions and 5 deletions

View File

@ -251,6 +251,9 @@ Release 2.0.1-alpha - UNRELEASED
HDFS-3574. Fix small race and do some cleanup in GetImageServlet (todd) HDFS-3574. Fix small race and do some cleanup in GetImageServlet (todd)
HDFS-3581. FSPermissionChecker#checkPermission sticky bit check
missing range check. (eli)
BREAKDOWN OF HDFS-3042 SUBTASKS BREAKDOWN OF HDFS-3042 SUBTASKS
HDFS-2185. HDFS portion of ZK-based FailoverController (todd) HDFS-2185. HDFS portion of ZK-based FailoverController (todd)

View File

@ -127,10 +127,10 @@ class FSPermissionChecker {
ancestorIndex--); ancestorIndex--);
checkTraverse(inodes, ancestorIndex); checkTraverse(inodes, ancestorIndex);
if(parentAccess != null && parentAccess.implies(FsAction.WRITE) if (parentAccess != null && parentAccess.implies(FsAction.WRITE)
&& inodes[inodes.length - 1] != null) && inodes.length > 1 && inodes[inodes.length - 1] != null) {
checkStickyBit(inodes[inodes.length - 2], inodes[inodes.length - 1]); checkStickyBit(inodes[inodes.length - 2], inodes[inodes.length - 1]);
}
if (ancestorAccess != null && inodes.length > 1) { if (ancestorAccess != null && inodes.length > 1) {
check(inodes, ancestorIndex, ancestorAccess); check(inodes, ancestorIndex, ancestorAccess);
} }

View File

@ -259,8 +259,8 @@ public class TestWebHdfsFileSystemContract extends FileSystemContractBaseTest {
assertTrue(status != null); assertTrue(status != null);
assertEquals(0777, status.getPermission().toShort()); assertEquals(0777, status.getPermission().toShort());
//delete root - disabled due to a sticky bit bug //delete root
//assertFalse(fs.delete(root, true)); assertFalse(fs.delete(root, true));
//create file using root path //create file using root path
try { try {