Sfoglia il codice sorgente

commit caffbd3b1fa84ec92a4ea524f82949b646b4f1eb
Author: Devaraj Das <ddas@yahoo-inc.com>
Date: Wed Mar 17 00:21:35 2010 -0700

HADOOP:6613 from https://issues.apache.org/jira/secure/attachment/12437831/HADOOP-6613-Y20S-1.patch

+++ b/YAHOO-CHANGES.txt
+ HADOOP-6613. Changes the RPC server so that version is checked first
+ on an incoming connection. (Kan Zhang via ddas)
+


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

Owen O'Malley 14 anni fa
parent
commit
b0fc62f126
1 ha cambiato i file con 10 aggiunte e 10 eliminazioni
  1. 10 10
      src/core/org/apache/hadoop/ipc/Server.java

+ 10 - 10
src/core/org/apache/hadoop/ipc/Server.java

@@ -1006,6 +1006,16 @@ public abstract class Server {
           byte[] method = new byte[] {rpcHeaderBuffer.get(1)};
           authMethod = AuthMethod.read(new DataInputStream(
               new ByteArrayInputStream(method)));
+          dataLengthBuffer.flip();          
+          if (!HEADER.equals(dataLengthBuffer) || version != CURRENT_VERSION) {
+            //Warning is ok since this is not supposed to happen.
+            LOG.warn("Incorrect header or version mismatch from " + 
+                     hostAddress + ":" + remotePort +
+                     " got version " + version + 
+                     " expected version " + CURRENT_VERSION);
+            return -1;
+          }
+          dataLengthBuffer.clear();
           if (authMethod == null) {
             throw new IOException("Unable to read authentication method");
           }
@@ -1030,16 +1040,6 @@ public abstract class Server {
             useSasl = true;
           }
           
-          dataLengthBuffer.flip();          
-          if (!HEADER.equals(dataLengthBuffer) || version != CURRENT_VERSION) {
-            //Warning is ok since this is not supposed to happen.
-            LOG.warn("Incorrect header or version mismatch from " + 
-                     hostAddress + ":" + remotePort +
-                     " got version " + version + 
-                     " expected version " + CURRENT_VERSION);
-            return -1;
-          }
-          dataLengthBuffer.clear();
           rpcHeaderBuffer = null;
           rpcHeaderRead = true;
           continue;