hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077692 - /hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobLocalizer.java
Date Fri, 04 Mar 2011 04:45:06 GMT
Author: omalley
Date: Fri Mar  4 04:45:05 2011
New Revision: 1077692

URL: http://svn.apache.org/viewvc?rev=1077692&view=rev
Log:
commit 8891c97ad9de98c54e52eece049c35696a936bd9
Author: Devaraj Das <ddas@yahoo-inc.com>
Date:   Fri Sep 17 23:04:19 2010 -0700

    Fixes the JobLocalizer to use the jobtoken correctly for creating the taskumbilical

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobLocalizer.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobLocalizer.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobLocalizer.java?rev=1077692&r1=1077691&r2=1077692&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobLocalizer.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobLocalizer.java
Fri Mar  4 04:45:05 2011
@@ -42,10 +42,12 @@ import org.apache.hadoop.fs.LocalDirAllo
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.io.IOUtils;
+import org.apache.hadoop.io.Text;
 import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.mapred.QueueManager.QueueACL;
 import org.apache.hadoop.mapreduce.JobID;
 import org.apache.hadoop.mapreduce.security.TokenCache;
+import org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier;
 import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.token.Token;
@@ -494,10 +496,23 @@ public class JobLocalizer {
     for (Token<? extends TokenIdentifier> token : creds.getAllTokens()) {
       ugi.addToken(token);
     }
-    final TaskUmbilicalProtocol taskTracker =
-      (TaskUmbilicalProtocol) RPC.getProxy(TaskUmbilicalProtocol.class,
-                                           TaskUmbilicalProtocol.versionID,
-                                           ttAddr, conf);
+    
+    UserGroupInformation ugiJob = UserGroupInformation.createRemoteUser(jobid);
+    Token<JobTokenIdentifier> jt = TokenCache.getJobToken(creds);
+    jt.setService(new Text(ttAddr.getAddress().getHostAddress() + ":"
+        + ttAddr.getPort()));
+    ugiJob.addToken(jt);
+
+    final TaskUmbilicalProtocol taskTracker = 
+      ugiJob.doAs(new PrivilegedExceptionAction<TaskUmbilicalProtocol>() {
+        public TaskUmbilicalProtocol run() throws IOException {
+          TaskUmbilicalProtocol taskTracker =
+            (TaskUmbilicalProtocol) RPC.getProxy(TaskUmbilicalProtocol.class,
+                TaskUmbilicalProtocol.versionID,
+                ttAddr, conf);
+          return taskTracker;
+        }
+      });
     System.exit(
       ugi.doAs(new PrivilegedExceptionAction<Integer>() {
         public Integer run() {



Mime
View raw message