Sfoglia il codice sorgente

commit 72b380e7218ab2da9b76b24d55ab459a357df7f8
Author: Jitendra Nath Pandey <jitendra@sufferhome-lm.(none)>
Date: Tue Mar 23 13:00:49 2010 -0700

HDFS-1039 from https://issues.apache.org/jira/secure/attachment/12439603/HDFS-1039-y20.2.1.patch

+++ b/YAHOO-CHANGES.txt
+ HDFS-1039. New patch on top of previous patch. Gets namenode address
+ from conf. (jitendra)
+


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

Owen O'Malley 14 anni fa
parent
commit
cef8336884

+ 1 - 1
src/hdfs/org/apache/hadoop/hdfs/server/namenode/ContentSummaryServlet.java

@@ -41,7 +41,7 @@ public class ContentSummaryServlet extends DfsServlet {
   public void doGet(final HttpServletRequest request,
       final HttpServletResponse response) throws ServletException, IOException {
     final Configuration conf = 
-      (Configuration) request.getAttribute("name.conf");
+      (Configuration) getServletContext().getAttribute("name.conf");
     final UserGroupInformation ugi = getUGI(request, conf);
     try {
       ugi.doAs(new PrivilegedExceptionAction<Object>() {

+ 6 - 2
src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java

@@ -436,8 +436,12 @@ public class JspHelper {
         Token<DelegationTokenIdentifier> token = 
           new Token<DelegationTokenIdentifier>();
         token.decodeFromUrlString(tokenString);
-        token.setService(new Text(nameNodeAddr.getAddress().getHostAddress() + ":"
-            + nameNodeAddr.getPort()));
+        InetSocketAddress serviceAddr = NameNode.getAddress(conf);
+        LOG.info("Setting service in token: "
+            + new Text(serviceAddr.getAddress().getHostAddress() + ":"
+                + serviceAddr.getPort()));
+        token.setService(new Text(serviceAddr.getAddress().getHostAddress()
+            + ":" + serviceAddr.getPort()));
         if (user == null) {
           //this really doesn't break any security since we use the 
           //delegation token for authentication in

+ 1 - 1
src/hdfs/org/apache/hadoop/hdfs/server/namenode/ListPathsServlet.java

@@ -136,7 +136,7 @@ public class ListPathsServlet extends DfsServlet {
       final Pattern filter = Pattern.compile(root.get("filter"));
       final Pattern exclude = Pattern.compile(root.get("exclude"));
       final Configuration conf = 
-        (Configuration) request.getAttribute("name.conf");
+        (Configuration) getServletContext().getAttribute("name.conf");
       
       ClientProtocol nnproxy = getUGI(request, conf).doAs
         (new PrivilegedExceptionAction<ClientProtocol>() {