|
@@ -70,6 +70,7 @@ import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifie
|
|
|
import org.apache.hadoop.hdfs.server.common.IncorrectVersionException;
|
|
|
import org.apache.hadoop.hdfs.server.common.UpgradeStatusReport;
|
|
|
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NamenodeRole;
|
|
|
+import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.metrics.NameNodeMetrics;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.web.resources.NamenodeWebHdfsMethods;
|
|
|
import org.apache.hadoop.hdfs.server.protocol.BlocksWithLocations;
|
|
@@ -243,6 +244,11 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private static UserGroupInformation getRemoteUser() throws IOException {
|
|
|
+ return NameNode.getRemoteUser();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/////////////////////////////////////////////////////
|
|
|
// NamenodeProtocol
|
|
|
/////////////////////////////////////////////////////
|
|
@@ -350,7 +356,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
|
}
|
|
|
namesystem.startFile(src,
|
|
|
- new PermissionStatus(UserGroupInformation.getCurrentUser().getShortUserName(),
|
|
|
+ new PermissionStatus(getRemoteUser().getShortUserName(),
|
|
|
null, masked),
|
|
|
clientName, clientMachine, flag.get(), createParent, replication, blockSize);
|
|
|
metrics.incrFilesCreated();
|
|
@@ -588,7 +594,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
|
}
|
|
|
return namesystem.mkdirs(src,
|
|
|
- new PermissionStatus(UserGroupInformation.getCurrentUser().getShortUserName(),
|
|
|
+ new PermissionStatus(getRemoteUser().getShortUserName(),
|
|
|
null, masked), createParent);
|
|
|
}
|
|
|
|
|
@@ -753,7 +759,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
if ("".equals(target)) {
|
|
|
throw new IOException("Invalid symlink target");
|
|
|
}
|
|
|
- final UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
|
+ final UserGroupInformation ugi = getRemoteUser();
|
|
|
namesystem.createSymlink(target, link,
|
|
|
new PermissionStatus(ugi.getShortUserName(), null, dirPerms), createParent);
|
|
|
}
|
|
@@ -892,7 +898,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
@Override // RefreshAuthorizationPolicyProtocol
|
|
|
public void refreshUserToGroupsMappings() throws IOException {
|
|
|
LOG.info("Refreshing all user-to-groups mappings. Requested by user: " +
|
|
|
- UserGroupInformation.getCurrentUser().getShortUserName());
|
|
|
+ getRemoteUser().getShortUserName());
|
|
|
Groups.getUserToGroupsMappingService().refresh();
|
|
|
}
|
|
|
|