Skip to content

Commit d3a6024

Browse files
committed
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/trunk@1356971 13f79535-47bb-0310-9956-ffa450edef68
1 parent e5d269e commit d3a6024

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,9 @@ Branch-2 ( Unreleased changes )
399399

400400
HDFS-3574. Fix small race and do some cleanup in GetImageServlet (todd)
401401

402+
HDFS-3581. FSPermissionChecker#checkPermission sticky bit check
403+
missing range check. (eli)
404+
402405
BREAKDOWN OF HDFS-3042 SUBTASKS
403406

404407
HDFS-2185. HDFS portion of ZK-based FailoverController (todd)

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ void checkPermission(String path, INodeDirectory root, boolean doCheckOwner,
127127
ancestorIndex--);
128128
checkTraverse(inodes, ancestorIndex);
129129

130-
if(parentAccess != null && parentAccess.implies(FsAction.WRITE)
131-
&& inodes[inodes.length - 1] != null)
130+
if (parentAccess != null && parentAccess.implies(FsAction.WRITE)
131+
&& inodes.length > 1 && inodes[inodes.length - 1] != null) {
132132
checkStickyBit(inodes[inodes.length - 2], inodes[inodes.length - 1]);
133-
133+
}
134134
if (ancestorAccess != null && inodes.length > 1) {
135135
check(inodes, ancestorIndex, ancestorAccess);
136136
}

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ public void testRootDir() throws IOException {
259259
assertTrue(status != null);
260260
assertEquals(0777, status.getPermission().toShort());
261261

262-
//delete root - disabled due to a sticky bit bug
263-
//assertFalse(fs.delete(root, true));
262+
//delete root
263+
assertFalse(fs.delete(root, true));
264264

265265
//create file using root path
266266
try {

0 commit comments

Comments
 (0)