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

(cherry picked from commit 1c3ff0b7c8)
This commit is contained in:
Vinayakumar B 2014-10-17 17:48:20 +05:30
parent fea721daf9
commit 7c87c2b42e
2 changed files with 7 additions and 4 deletions

View File

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

View File

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