You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:03:14 UTC

svn commit: r1077321 - in /hadoop/common/branches/branch-0.20-security-patches/src: hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java webapps/datanode/browseDirectory.jsp

Author: omalley
Date: Fri Mar  4 04:03:14 2011
New Revision: 1077321

URL: http://svn.apache.org/viewvc?rev=1077321&view=rev
Log:
commit cc1043c5914bea27225cfdf14ac0384cc851fc8f
Author: Jitendra Nath Pandey <jitendra@sufferhome-lm.(none)>
Date:   Tue Mar 16 15:46:02 2010 -0700

    HDFS-1039 from https://issues.apache.org/jira/secure/attachment/12438896/HDFS-1039-y20.2.patch
    
    +++ b/YAHOO-CHANGES.txt
    +    HDFS-1039. Service should be set in the token in JspHelper.getUGI.
    +    (jitendra)
    +

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java
    hadoop/common/branches/branch-0.20-security-patches/src/webapps/datanode/browseDirectory.jsp

Modified: hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java?rev=1077321&r1=1077320&r2=1077321&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java Fri Mar  4 04:03:14 2011
@@ -48,6 +48,7 @@ import org.apache.hadoop.hdfs.server.dat
 import org.apache.hadoop.hdfs.server.namenode.DatanodeDescriptor;
 import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
 import org.apache.hadoop.http.HtmlQuoting;
+import org.apache.hadoop.io.Text;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.security.AccessControlException;
 import org.apache.hadoop.security.UserGroupInformation;
@@ -354,8 +355,8 @@ public class JspHelper {
       String[] parts = dir.split(Path.SEPARATOR);
       StringBuilder tempPath = new StringBuilder(dir.length());
       out.print("<a href=\"browseDirectory.jsp" + "?dir="+ Path.SEPARATOR
-          + "&namenodeInfoPort=" + namenodeInfoPort
-          + "\">" + Path.SEPARATOR + "</a>");
+          + "&namenodeInfoPort=" + namenodeInfoPort + SET_DELEGATION
+          + tokenString + "\">" + Path.SEPARATOR + "</a>");
       tempPath.append(Path.SEPARATOR);
       for (int i = 0; i < parts.length-1; i++) {
         if (!parts[i].equals("")) {
@@ -435,6 +436,8 @@ public class JspHelper {
         Token<DelegationTokenIdentifier> token = 
           new Token<DelegationTokenIdentifier>();
         token.decodeFromUrlString(tokenString);
+        token.setService(new Text(nameNodeAddr.getAddress().getHostAddress() + ":"
+            + nameNodeAddr.getPort()));
         if (user == null) {
           //this really doesn't break any security since we use the 
           //delegation token for authentication in

Modified: hadoop/common/branches/branch-0.20-security-patches/src/webapps/datanode/browseDirectory.jsp
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/webapps/datanode/browseDirectory.jsp?rev=1077321&r1=1077320&r2=1077321&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/webapps/datanode/browseDirectory.jsp (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/webapps/datanode/browseDirectory.jsp Fri Mar  4 04:03:14 2011
@@ -138,7 +138,8 @@
           }
           String datanodeUrl = req.getRequestURL()+"?dir="+
               URLEncoder.encode(files[i].getFullName(target).toString(), "UTF-8") + 
-              "&namenodeInfoPort=" + namenodeInfoPort;
+              "&namenodeInfoPort=" + namenodeInfoPort + JspHelper.SET_DELEGATION + 
+              tokenString;
           cols[0] = "<a href=\""+datanodeUrl+"\">"+localname+"</a>";
           cols[5] = FsShell.dateForm.format(new Date((files[i].getModificationTime())));
           cols[6] = files[i].getPermission().toString();