HDFS-10455. Logging the username when deny the setOwner operation. Contributed by Rakesh R.

This commit is contained in:
Brahma Reddy Battula 2016-11-01 10:49:43 +05:30
parent 2226ae4924
commit 1c5708f6de
1 changed files with 4 additions and 2 deletions

View File

@ -83,10 +83,12 @@ static HdfsFileStatus setOwner(
fsd.checkOwner(pc, iip);
if (!pc.isSuperUser()) {
if (username != null && !pc.getUser().equals(username)) {
throw new AccessControlException("Non-super user cannot change owner");
throw new AccessControlException("User " + username
+ " is not a super user (non-super user cannot change owner).");
}
if (group != null && !pc.isMemberOfGroup(group)) {
throw new AccessControlException("User does not belong to " + group);
throw new AccessControlException(
"User " + username + " does not belong to " + group);
}
}
unprotectedSetOwner(fsd, iip, username, group);