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:41 UTC

svn commit: r1077325 - /hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java

Author: omalley
Date: Fri Mar  4 04:03:40 2011
New Revision: 1077325

URL: http://svn.apache.org/viewvc?rev=1077325&view=rev
Log:
commit caffbd3b1fa84ec92a4ea524f82949b646b4f1eb
Author: Devaraj Das <dd...@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)
    +

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java?rev=1077325&r1=1077324&r2=1077325&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java Fri Mar  4 04:03:40 2011
@@ -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;