Browse Source

HDFS-2373. Commands using webhdfs and hftp print unnecessary debug info on the console with security enabled. Contributed by Arpit Gupta.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-205@1176638 13f79535-47bb-0310-9956-ffa450edef68
Suresh Srinivas 14 years ago
parent
commit
b5a4b5b3a8
2 changed files with 18 additions and 5 deletions
  1. 3 0
      CHANGES.txt
  2. 15 5
      src/hdfs/org/apache/hadoop/hdfs/tools/DelegationTokenFetcher.java

+ 3 - 0
CHANGES.txt

@@ -230,6 +230,9 @@ Release 0.20.205.0 - 2011.09.27
 
     HDFS-2375. Fix TestFileAppend4 failure. (suresh)
 
+    HDFS-2373. Commands using webhdfs and hftp print unnecessary debug 
+    info on the console with security enabled. (Arpit Gupta via suresh)
+
   IMPROVEMENTS
 
     MAPREDUCE-2928. MR-2413 improvements (Eli Collins via mattf)

+ 15 - 5
src/hdfs/org/apache/hadoop/hdfs/tools/DelegationTokenFetcher.java

@@ -129,29 +129,37 @@ public class DelegationTokenFetcher {
           for(Token<?> token: readTokens(tokenFile, conf)) {
             if (token.isManaged()) {
               token.cancel(conf);
-              System.out.println("Cancelled token for " + token.getService());
+              if(LOG.isDebugEnabled()) {
+                LOG.debug("Cancelled token for " + token.getService());
+              }
             }
           }          
         } else if (renew) {
           for(Token<?> token: readTokens(tokenFile, conf)) {
             if (token.isManaged()) {
               token.renew(conf);
-              System.out.println("Renewed token for " + token.getService());
+              if(LOG.isDebugEnabled()) {
+                LOG.debug("Renewed token for " + token.getService());
+              }
             }
           }          
         } else {
           if (webUrl != null) {
             getDTfromRemote(webUrl, null).
               writeTokenStorageFile(tokenFile, conf);
-            System.out.println("Fetched token via http for " + webUrl);
+            if(LOG.isDebugEnabled()) {
+              LOG.debug("Fetched token via http for " + webUrl);
+            }
           } else {
             FileSystem fs = FileSystem.get(conf);
             Token<?> token = fs.getDelegationToken(ugi.getShortUserName());
             Credentials cred = new Credentials();
             cred.addToken(token.getService(), token);
             cred.writeTokenStorageFile(tokenFile, conf);
-            System.out.println("Fetched token for " + fs.getUri() + " into " +
+            if(LOG.isDebugEnabled()) {
+              LOG.debug("Fetched token for " + fs.getUri() + " into " +
                                tokenFile);
+            }
           }        
         }
         return null;
@@ -176,7 +184,9 @@ public class DelegationTokenFetcher {
       } else {
         url.append(nnAddr).append(GetDelegationTokenServlet.PATH_SPEC);
       }
-      System.out.println("Retrieving token from: " + url);
+      if(LOG.isDebugEnabled()) {
+        LOG.debug("Retrieving token from: " + url);
+      }
       URL remoteURL = new URL(url.toString());
       SecurityUtil.fetchServiceTicket(remoteURL);
       URLConnection connection = remoteURL.openConnection();