HADOOP-9806 PortmapInterface should check if the procedure is out-of-range. Contributed by Brandon Li
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1509347 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
381a4c4213
commit
60be5fb9ed
@ -269,6 +269,9 @@ Trunk (Unreleased)
|
||||
HADOOP-9433 TestLocalFileSystem#testHasFileDescriptor leaks file handle
|
||||
(Chris Nauroth via sanjay)
|
||||
|
||||
HADOOP-9806 PortmapInterface should check if the procedure is out-of-range
|
||||
(brandonli)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HADOOP-7761. Improve the performance of raw comparisons. (todd)
|
||||
|
@ -45,6 +45,9 @@ public int getValue() {
|
||||
}
|
||||
|
||||
public static Procedure fromValue(int value) {
|
||||
if (value < 0 || value >= values().length) {
|
||||
return null;
|
||||
}
|
||||
return values()[value];
|
||||
}
|
||||
}
|
||||
|
@ -131,29 +131,22 @@ public void register(PortmapMapping mapping) {
|
||||
@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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user