Selaa lähdekoodia

commit ace335211d3ae8c52991b944c039d79f6cdaeb0e
Author: Owen O'Malley <omalley@apache.org>
Date: Fri Mar 19 17:12:53 2010 -0700

HADOOP-6648. Credentials must ignore null tokens that can be generated
when using HFTP to talk to insecure clusters. (omalley)

+++ b/YAHOO-CHANGES.txt
+ HADOOP-6648. Credentials must ignore null tokens that can be generated
+ when using HFTP to talk to insecure clusters. (omalley)
+


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1077349 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 vuotta sitten
vanhempi
commit
ff14854bb8

+ 8 - 1
src/core/org/apache/hadoop/security/Credentials.java

@@ -28,6 +28,8 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FSDataOutputStream;
@@ -43,6 +45,7 @@ import org.apache.hadoop.security.token.TokenIdentifier;
  * secret keys and Tokens.
  */
 public class Credentials implements Writable {
+  private static final Log LOG = LogFactory.getLog(Credentials.class);
 
   private  Map<Text, byte[]> secretKeysMap = new HashMap<Text, byte[]>();
   private  Map<Text, Token<? extends TokenIdentifier>> tokenMap = 
@@ -72,7 +75,11 @@ public class Credentials implements Writable {
    * @param t the token object
    */
   public void addToken(Text alias, Token<? extends TokenIdentifier> t) {
-    tokenMap.put(alias, t);
+    if (t != null) {
+      tokenMap.put(alias, t);
+    } else {
+      LOG.warn("Null token ignored for " + alias);
+    }
   }
   
   /**

+ 1 - 0
src/hdfs/org/apache/hadoop/hdfs/HftpFileSystem.java

@@ -140,6 +140,7 @@ public class HftpFileSystem extends FileSystem {
             } catch (Exception e) {
               LOG.info("Couldn't get a delegation token from " + nnHttpUrl + 
               " using https.");
+              LOG.debug("error was ", e);
               //Maybe the server is in unsecure mode (that's bad but okay)
               return null;
             }