hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brando...@apache.org
Subject svn commit: r1509427 - in /hadoop/common/branches/branch-2/hadoop-common-project: hadoop-common/CHANGES.txt hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapInterface.java hadoop-nfs/src/main/java/org/apache/hadoop/portmap/RpcProgramPortmap.java
Date Thu, 01 Aug 2013 20:46:18 GMT
Author: brandonli
Date: Thu Aug  1 20:46:18 2013
New Revision: 1509427

URL: http://svn.apache.org/r1509427
Log:
HADOOP-9806. Merging r1509347 from trunk

Modified:
    hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapInterface.java
    hadoop/common/branches/branch-2/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/RpcProgramPortmap.java

Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1509427&r1=1509426&r2=1509427&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt Thu Aug
 1 20:46:18 2013
@@ -36,6 +36,9 @@ Release 2.3.0 - UNRELEASED
     HADOOP-9582. Non-existent file to "hadoop fs -conf" doesn't throw error
     (Ashwin Shankar via jlowe)
 
+    HADOOP-9806 PortmapInterface should check if the procedure is out-of-range
+    (brandonli)
+
 Release 2.1.1-beta - UNRELEASED
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapInterface.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapInterface.java?rev=1509427&r1=1509426&r2=1509427&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapInterface.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapInterface.java
Thu Aug  1 20:46:18 2013
@@ -45,6 +45,9 @@ public interface PortmapInterface {
     }
     
     public static Procedure fromValue(int value) {
+      if (value < 0 || value >= values().length) {
+        return null;
+      }
       return values()[value];
     }
   }

Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/RpcProgramPortmap.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/RpcProgramPortmap.java?rev=1509427&r1=1509426&r2=1509427&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/RpcProgramPortmap.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/RpcProgramPortmap.java
Thu Aug  1 20:46:18 2013
@@ -131,29 +131,22 @@ public class RpcProgramPortmap extends R
   @Override
   public XDR handleInternal(RpcCall rpcCall, XDR in, XDR out,
       InetAddress client, Channel channel) {
-    Procedure procedure = Procedure.fromValue(rpcCall.getProcedure());
+    final Procedure portmapProc = Procedure.fromValue(rpcCall.getProcedure());
     int xid = rpcCall.getXid();
-    switch (procedure) {
-    case PMAPPROC_NULL:
+    if (portmapProc == Procedure.PMAPPROC_NULL) {
       out = nullOp(xid, in, out);
-      break;
-    case PMAPPROC_SET:
+    } else if (portmapProc == Procedure.PMAPPROC_SET) {
       out = set(xid, in, out);
-      break;
-    case PMAPPROC_UNSET:
+    } else if (portmapProc == Procedure.PMAPPROC_UNSET) {
       out = unset(xid, in, out);
-      break;
-    case PMAPPROC_DUMP:
+    } else if (portmapProc == Procedure.PMAPPROC_DUMP) {
       out = dump(xid, in, out);
-      break;
-    case PMAPPROC_GETPORT:
+    } else if (portmapProc == Procedure.PMAPPROC_GETPORT) {
       out = getport(xid, in, out);
-      break;
-    case PMAPPROC_GETVERSADDR:
+    } else if (portmapProc == Procedure.PMAPPROC_GETVERSADDR) {
       out = getport(xid, in, out);
-      break;
-    default:
-      LOG.info("PortmapHandler unknown rpc procedure=" + procedure);
+    } else {
+      LOG.info("PortmapHandler unknown rpc procedure=" + portmapProc);
       RpcAcceptedReply.voidReply(out, xid,
           RpcAcceptedReply.AcceptState.PROC_UNAVAIL);
     }



Mime
View raw message