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/06/19 03:44:19 UTC

svn commit: r956171 - in /hadoop/mapreduce/trunk: CHANGES.txt src/java/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java

Author: ddas
Date: Sat Jun 19 01:44:19 2010
New Revision: 956171

URL: http://svn.apache.org/viewvc?rev=956171&view=rev
Log:
MAPREDUCE-1559. Fixes the token renewer to use the JobTracker's credentials for talking to the NameNode. Contributed by Devaraj Das.

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=956171&r1=956170&r2=956171&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Sat Jun 19 01:44:19 2010
@@ -99,6 +99,9 @@ Trunk (unreleased changes)
     MAPREDUCE-1225. Fixes DistributedCache to check if the file is fresh or not,
     for the first localization also. (Zhong Wang via amareshwari)
 
+    MAPREDUCE-1559. Fixes the token renewer to use the JobTracker's 
+    credentials for talking to the NameNode. (ddas)
+
 Release 0.21.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java?rev=956171&r1=956170&r2=956171&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java (original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java Sat Jun 19 01:44:19 2010
@@ -21,6 +21,9 @@ package org.apache.hadoop.mapreduce.secu
 import java.io.IOException;
 import java.net.URI;
 import org.apache.hadoop.security.AccessControlException;
+import org.apache.hadoop.security.UserGroupInformation;
+
+import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -204,12 +207,20 @@ public class DelegationTokenRenewal {
   }
   
   private static DistributedFileSystem getDFSForToken(
-      Token<DelegationTokenIdentifier> token, Configuration conf) 
+      Token<DelegationTokenIdentifier> token, final Configuration conf) 
   throws Exception {
     DistributedFileSystem dfs = null;
     try {
-      URI uri = new URI (SCHEME + "://" + token.getService().toString());
-      dfs =  (DistributedFileSystem) FileSystem.get(uri, conf);
+      final URI uri = new URI (SCHEME + "://" + token.getService().toString());
+      dfs = 
+      UserGroupInformation.getLoginUser().doAs(
+          new PrivilegedExceptionAction<DistributedFileSystem>() {
+        public DistributedFileSystem run() throws IOException {
+          return (DistributedFileSystem) FileSystem.get(uri, conf);  
+        }
+      });
+
+      
     } catch (Exception e) {
       LOG.warn("Failed to create a dfs to renew for:" + token.getService(), e);
       throw e;