HDFS-13626. Fix incorrect username when deny the setOwner operation. Contributed by Zsolt Venczel.

This commit is contained in:
Yiqun Lin 2018-05-30 16:55:39 +08:00
parent 6d7d192e47
commit cb962139ee

View File

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