Просмотр исходного кода

MAPREDUCE-3593. Fix user impersonation. Contributed by Mayank Bansal.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.22@1229749 13f79535-47bb-0310-9956-ffa450edef68
Konstantin Shvachko 13 лет назад
Родитель
Сommit
7826691044

+ 2 - 0
mapreduce/CHANGES.txt

@@ -12,6 +12,8 @@ Release 0.22.1 - Unreleased
 
 
   BUG FIXES
   BUG FIXES
 
 
+    MAPREDUCE-3593. Fix user impersonation. (Mayank Bansal via shv)
+
 Release 0.22.0 - 2011-11-29
 Release 0.22.0 - 2011-11-29
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 9 - 0
mapreduce/src/java/org/apache/hadoop/mapreduce/Cluster.java

@@ -397,4 +397,13 @@ public class Cluster {
     }
     }
   }
   }
 
 
+  /**
+   * Get the UGI set for the cluster at the time of 
+   * constructing the cluster object with the conf.
+   * @return UserGroupInformation 
+   */
+  public UserGroupInformation getUgi() {
+    return ugi;
+  }
+
 }
 }

+ 1 - 1
mapreduce/src/java/org/apache/hadoop/mapreduce/Job.java

@@ -1039,7 +1039,7 @@ public class Job extends JobContextImpl implements JobContext {
     connect();
     connect();
     final JobSubmitter submitter = new JobSubmitter(cluster.getFileSystem(),
     final JobSubmitter submitter = new JobSubmitter(cluster.getFileSystem(),
         cluster.getClient());
         cluster.getClient());
-    status = ugi.doAs(new PrivilegedExceptionAction<JobStatus>() {
+    status = this.cluster.getUgi().doAs(new PrivilegedExceptionAction<JobStatus>() {
       public JobStatus run() throws IOException, InterruptedException, 
       public JobStatus run() throws IOException, InterruptedException, 
       ClassNotFoundException {
       ClassNotFoundException {
         return submitter.submitJobInternal(Job.this, cluster);
         return submitter.submitJobInternal(Job.this, cluster);