HDFS-7242. Code improvement for FSN#checkUnreadableBySuperuser. (Contributed by Yi Liu)

This commit is contained in:
Vinayakumar B 2014-10-17 17:48:20 +05:30
parent cba1f9e389
commit 1c3ff0b7c8
2 changed files with 7 additions and 4 deletions

View File

@ -399,6 +399,9 @@ Release 2.7.0 - UNRELEASED
HDFS-7190. Bad use of Preconditions in startFileInternal(). HDFS-7190. Bad use of Preconditions in startFileInternal().
(Dawson Choong via wheat9) (Dawson Choong via wheat9)
HDFS-7242. Code improvement for FSN#checkUnreadableBySuperuser.
(Yi Liu via vinayakumarb)
Release 2.6.0 - UNRELEASED Release 2.6.0 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -6412,10 +6412,10 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
private void checkUnreadableBySuperuser(FSPermissionChecker pc, private void checkUnreadableBySuperuser(FSPermissionChecker pc,
INode inode, int snapshotId) INode inode, int snapshotId)
throws IOException { throws IOException {
for (XAttr xattr : dir.getXAttrs(inode, snapshotId)) { if (pc.isSuperUser()) {
if (XAttrHelper.getPrefixName(xattr). for (XAttr xattr : dir.getXAttrs(inode, snapshotId)) {
equals(SECURITY_XATTR_UNREADABLE_BY_SUPERUSER)) { if (XAttrHelper.getPrefixName(xattr).
if (pc.isSuperUser()) { equals(SECURITY_XATTR_UNREADABLE_BY_SUPERUSER)) {
throw new AccessControlException("Access is denied for " + throw new AccessControlException("Access is denied for " +
pc.getUser() + " since the superuser is not allowed to " + pc.getUser() + " since the superuser is not allowed to " +
"perform this operation."); "perform this operation.");