hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1233749 - in /hadoop/common/branches/branch-1: CHANGES.txt src/core/org/apache/hadoop/security/UserGroupInformation.java
Date Fri, 20 Jan 2012 03:32:27 GMT
Author: todd
Date: Fri Jan 20 03:32:26 2012
New Revision: 1233749

URL: http://svn.apache.org/viewvc?rev=1233749&view=rev
Log:
HADOOP-7982. UserGroupInformation fails to login if thread's context classloader can't load
HadoopLoginModule. Contributed by Todd Lipcon.

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/UserGroupInformation.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1233749&r1=1233748&r2=1233749&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Fri Jan 20 03:32:26 2012
@@ -86,6 +86,9 @@ Release 1.1.0 - unreleased
     HDFS-2790. FSNamesystem.setTimes throws exception with wrong
     configuration name in the message. (Arpit Gupta via eli)
 
+    HADOOP-7982. UserGroupInformation fails to login if thread's context
+    classloader can't load HadoopLoginModule. (todd)
+
   IMPROVEMENTS
 
     MAPREDUCE-2517. Add system tests to Gridmix. (Vinay Thota via amarrk)

Modified: hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/UserGroupInformation.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/UserGroupInformation.java?rev=1233749&r1=1233748&r2=1233749&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/UserGroupInformation.java
(original)
+++ hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/UserGroupInformation.java
Fri Jan 20 03:32:26 2012
@@ -371,9 +371,19 @@ public class UserGroupInformation {
   
   private static LoginContext
   newLoginContext(String appName, Subject subject) throws LoginException {
-    return new LoginContext(appName, subject, null, new HadoopConfiguration());
+    // Temporarily switch the thread's ContextClassLoader to match this
+    // class's classloader, so that we can properly load HadoopLoginModule
+    // from the JAAS libraries.
+    Thread t = Thread.currentThread();
+    ClassLoader oldCCL = t.getContextClassLoader();
+    t.setContextClassLoader(HadoopLoginModule.class.getClassLoader());
+    try {
+      return new LoginContext(appName, subject, null, new HadoopConfiguration());
+    } finally {
+      t.setContextClassLoader(oldCCL);
+    }
   }
-  
+
   private LoginContext getLogin() {
     return user.getLogin();
   }



Mime
View raw message