Return-Path: Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: (qmail 32833 invoked from network); 4 Mar 2011 04:04:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Mar 2011 04:04:02 -0000 Received: (qmail 84674 invoked by uid 500); 4 Mar 2011 04:04:02 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 84402 invoked by uid 500); 4 Mar 2011 04:04:02 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 84367 invoked by uid 99); 4 Mar 2011 04:04:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Mar 2011 04:04:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Mar 2011 04:04:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4F7F62388962; Fri, 4 Mar 2011 04:03:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1077325 - /hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java Date: Fri, 04 Mar 2011 04:03:41 -0000 To: common-commits@hadoop.apache.org From: omalley@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110304040341.4F7F62388962@eris.apache.org> 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 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;