You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-commits@hadoop.apache.org by dd...@apache.org on 2010/05/14 21:50:12 UTC

svn commit: r944427 - in /hadoop/mapreduce/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/tools/MRAdmin.java

Author: ddas
Date: Fri May 14 19:50:12 2010
New Revision: 944427

URL: http://svn.apache.org/viewvc?rev=944427&view=rev
Log:
MAPREDUCE-1558. Fixes MRAdmin to look up the principal of the JobTracker and use that in the RefreshUserToGroupsMapping protocol and RefreshAuthorizationPolicyProtocol. Contributed by Boris Shkolnik.

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/tools/MRAdmin.java

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=944427&r1=944426&r2=944427&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Fri May 14 19:50:12 2010
@@ -34,6 +34,10 @@ Trunk (unreleased changes)
     actual user when the proxy-user is used for submitting jobs. Also
     refactors the DelegationTokenToRenew class. (ddas)
 
+    MAPREDUCE-1558. Fixes MRAdmin to look up the principal of the 
+    JobTracker and use that in the RefreshUserToGroupsMapping protocol and
+    RefreshAuthorizationPolicyProtocol. (Boris Shkolnik via ddas)
+
 Release 0.21.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/tools/MRAdmin.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/tools/MRAdmin.java?rev=944427&r1=944426&r2=944427&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/tools/MRAdmin.java (original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/tools/MRAdmin.java Fri May 14 19:50:12 2010
@@ -21,10 +21,12 @@ import java.io.IOException;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configured;
+import org.apache.hadoop.fs.CommonConfigurationKeys;
 import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.ipc.RemoteException;
-import org.apache.hadoop.mapred.JobTracker;
 import org.apache.hadoop.mapred.AdminOperationsProtocol;
+import org.apache.hadoop.mapred.JobConf;
+import org.apache.hadoop.mapred.JobTracker;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.RefreshUserToGroupMappingsProtocol;
 import org.apache.hadoop.security.UserGroupInformation;
@@ -128,6 +130,13 @@ public class MRAdmin extends Configured 
     // Get the current configuration
     Configuration conf = getConf();
     
+    // for security authorization
+    // server principal for this call   
+    // should be JT's one.
+    JobConf jConf = new JobConf(conf);
+    conf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY, 
+        jConf.get(JobTracker.JT_USER_NAME, ""));
+
     // Create the client
     RefreshAuthorizationPolicyProtocol refreshProtocol = 
       (RefreshAuthorizationPolicyProtocol) 
@@ -151,6 +160,14 @@ public class MRAdmin extends Configured 
   private int refreshUserToGroupsMappings() throws IOException {
     // Get the current configuration
     Configuration conf = getConf();
+    
+    // for security authorization
+    // server principal for this call   
+    // should be JT's one.
+    JobConf jConf = new JobConf(conf);
+    conf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY, 
+        jConf.get(JobTracker.JT_USER_NAME, ""));
+
     // Create the client
     RefreshUserToGroupMappingsProtocol refreshProtocol = 
       (RefreshUserToGroupMappingsProtocol)