{
tm.sendAsynchronousMessage(new PacketChannelSuccess(c.remoteID).getPayload());
}
else
{
tm.sendAsynchronousMessage(new PacketChannelFailure(c.remoteID).getPayload());
}
}
if (run_after_sending_success != null)
{
runAsync(run_after_sending_success);
}
return;
}
if ((server_session != null) && (type.equals("shell")))
{
if (tr.remain() != 0)
throw new IOException("Badly formatted SSH_MSG_CHANNEL_REQUEST message");
Runnable run_after_sending_success = null;
ServerSessionCallback sscb = server_session.getServerSessionCallback();
if (sscb != null)
run_after_sending_success = sscb.requestShell(server_session);
if (wantReply)
{
if (run_after_sending_success != null)
{
tm.sendAsynchronousMessage(new PacketChannelSuccess(c.remoteID).getPayload());
}
else
{
tm.sendAsynchronousMessage(new PacketChannelFailure(c.remoteID).getPayload());
}
}
if (run_after_sending_success != null)
{
runAsync(run_after_sending_success);
}
return;
}
if ((server_session != null) && (type.equals("exec")))
{
String command = tr.readString();
if (tr.remain() != 0)
throw new IOException("Badly formatted SSH_MSG_CHANNEL_REQUEST message");
Runnable run_after_sending_success = null;
ServerSessionCallback sscb = server_session.getServerSessionCallback();
if (sscb != null)
run_after_sending_success = sscb.requestExec(server_session, command);
if (wantReply)
{
if (run_after_sending_success != null)
{
tm.sendAsynchronousMessage(new PacketChannelSuccess(c.remoteID).getPayload());
}
else
{
tm.sendAsynchronousMessage(new PacketChannelFailure(c.remoteID).getPayload());
}
}
if (run_after_sending_success != null)
{
runAsync(run_after_sending_success);
}
return;
}
/* We simply ignore unknown channel requests, however, if the server wants a reply,
* then we signal that we have no idea what it is about.
*/
if (wantReply)
{
tm.sendAsynchronousMessage(new PacketChannelFailure(c.remoteID).getPayload());
}
log.debug("Channel request '" + type + "' is not known, ignoring it");
}