HDFS-3444. hdfs groups command doesn't work with security enabled. Contributed by Aaron T. Myers.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1340260 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7d1f97b821
commit
ea0baa3609
@ -226,6 +226,8 @@ Release 2.0.1-alpha - UNRELEASED
|
||||
HDFS-3391. Fix InvalidateBlocks to compare blocks including their
|
||||
generation stamps. (todd)
|
||||
|
||||
HDFS-3444. hdfs groups command doesn't work with security enabled. (atm)
|
||||
|
||||
Release 2.0.0-alpha - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
@ -20,9 +20,13 @@
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.GetUserMappingsProtocolProtos.GetUserMappingsProtocolService;
|
||||
import org.apache.hadoop.ipc.ProtocolInfo;
|
||||
import org.apache.hadoop.security.KerberosInfo;
|
||||
|
||||
@KerberosInfo(
|
||||
serverPrincipal=CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY)
|
||||
@ProtocolInfo(
|
||||
protocolName = "org.apache.hadoop.tools.GetUserMappingsProtocol",
|
||||
protocolVersion = 1)
|
||||
|
@ -21,14 +21,16 @@
|
||||
import java.io.PrintStream;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
||||
import org.apache.hadoop.hdfs.HdfsConfiguration;
|
||||
import org.apache.hadoop.hdfs.NameNodeProxies;
|
||||
import org.apache.hadoop.hdfs.protocolPB.GetUserMappingsProtocolClientSideTranslatorPB;
|
||||
import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.tools.GetGroupsBase;
|
||||
import org.apache.hadoop.tools.GetUserMappingsProtocol;
|
||||
import org.apache.hadoop.util.ToolRunner;
|
||||
@ -39,6 +41,8 @@
|
||||
*/
|
||||
@InterfaceAudience.Private
|
||||
public class GetGroups extends GetGroupsBase {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(GetGroups.class);
|
||||
|
||||
static{
|
||||
HdfsConfiguration.init();
|
||||
@ -59,6 +63,22 @@ protected InetSocketAddress getProtocolAddress(Configuration conf)
|
||||
return NameNode.getAddress(conf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConf(Configuration conf) {
|
||||
conf = new HdfsConfiguration(conf);
|
||||
String nameNodePrincipal = conf.get(
|
||||
DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY, "");
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Using NN principal: " + nameNodePrincipal);
|
||||
}
|
||||
|
||||
conf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY,
|
||||
nameNodePrincipal);
|
||||
|
||||
super.setConf(conf);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GetUserMappingsProtocol getUgmProtocol() throws IOException {
|
||||
return NameNodeProxies.createProxy(getConf(), FileSystem.getDefaultUri(getConf()),
|
||||
|
Loading…
Reference in New Issue
Block a user