|
@@ -196,9 +196,9 @@ class FSPermissionChecker implements AccessControlEnforcer {
|
|
* Check whether exception e is due to an ancestor inode's not being
|
|
* Check whether exception e is due to an ancestor inode's not being
|
|
* directory.
|
|
* directory.
|
|
*/
|
|
*/
|
|
- private void checkAncestorType(INode[] inodes, int ancestorIndex,
|
|
|
|
|
|
+ private void checkAncestorType(INode[] inodes, int checkedAncestorIndex,
|
|
AccessControlException e) throws AccessControlException {
|
|
AccessControlException e) throws AccessControlException {
|
|
- for (int i = 0; i <= ancestorIndex; i++) {
|
|
|
|
|
|
+ for (int i = 0; i <= checkedAncestorIndex; i++) {
|
|
if (inodes[i] == null) {
|
|
if (inodes[i] == null) {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -221,11 +221,8 @@ class FSPermissionChecker implements AccessControlEnforcer {
|
|
throws AccessControlException {
|
|
throws AccessControlException {
|
|
for(; ancestorIndex >= 0 && inodes[ancestorIndex] == null;
|
|
for(; ancestorIndex >= 0 && inodes[ancestorIndex] == null;
|
|
ancestorIndex--);
|
|
ancestorIndex--);
|
|
- try {
|
|
|
|
- checkTraverse(inodeAttrs, path, ancestorIndex);
|
|
|
|
- } catch (AccessControlException e) {
|
|
|
|
- checkAncestorType(inodes, ancestorIndex, e);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ checkTraverse(inodeAttrs, inodes, path, ancestorIndex);
|
|
|
|
|
|
final INodeAttributes last = inodeAttrs[inodeAttrs.length - 1];
|
|
final INodeAttributes last = inodeAttrs[inodeAttrs.length - 1];
|
|
if (parentAccess != null && parentAccess.implies(FsAction.WRITE)
|
|
if (parentAccess != null && parentAccess.implies(FsAction.WRITE)
|
|
@@ -276,10 +273,15 @@ class FSPermissionChecker implements AccessControlEnforcer {
|
|
}
|
|
}
|
|
|
|
|
|
/** Guarded by {@link FSNamesystem#readLock()} */
|
|
/** Guarded by {@link FSNamesystem#readLock()} */
|
|
- private void checkTraverse(INodeAttributes[] inodes, String path, int last
|
|
|
|
- ) throws AccessControlException {
|
|
|
|
- for(int j = 0; j <= last; j++) {
|
|
|
|
- check(inodes[j], path, FsAction.EXECUTE);
|
|
|
|
|
|
+ private void checkTraverse(INodeAttributes[] inodeAttrs, INode[] inodes,
|
|
|
|
+ String path, int last) throws AccessControlException {
|
|
|
|
+ int j = 0;
|
|
|
|
+ try {
|
|
|
|
+ for (; j <= last; j++) {
|
|
|
|
+ check(inodeAttrs[j], path, FsAction.EXECUTE);
|
|
|
|
+ }
|
|
|
|
+ } catch (AccessControlException e) {
|
|
|
|
+ checkAncestorType(inodes, j, e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|