소스 검색

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 년 전
부모
커밋
7826691044
3개의 변경된 파일12개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 0
      mapreduce/CHANGES.txt
  2. 9 0
      mapreduce/src/java/org/apache/hadoop/mapreduce/Cluster.java
  3. 1 1
      mapreduce/src/java/org/apache/hadoop/mapreduce/Job.java

+ 2 - 0
mapreduce/CHANGES.txt

@@ -12,6 +12,8 @@ Release 0.22.1 - Unreleased
 
   BUG FIXES
 
+    MAPREDUCE-3593. Fix user impersonation. (Mayank Bansal via shv)
+
 Release 0.22.0 - 2011-11-29
 
   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();
     final JobSubmitter submitter = new JobSubmitter(cluster.getFileSystem(),
         cluster.getClient());
-    status = ugi.doAs(new PrivilegedExceptionAction<JobStatus>() {
+    status = this.cluster.getUgi().doAs(new PrivilegedExceptionAction<JobStatus>() {
       public JobStatus run() throws IOException, InterruptedException, 
       ClassNotFoundException {
         return submitter.submitJobInternal(Job.this, cluster);