mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-07 07:40:55 +03:00
Handle server initiated global requests (#472)
* Handle server initiated global requests * Code layout
This commit is contained in:
committed by
Jeroen van Erp
parent
17c09eb471
commit
b0dee02bf9
@@ -130,6 +130,9 @@ public class ConnectionImpl
|
|||||||
getChannel(buf).handle(msg, buf);
|
getChannel(buf).handle(msg, buf);
|
||||||
} else if (msg.in(80, 90)) {
|
} else if (msg.in(80, 90)) {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
|
case GLOBAL_REQUEST:
|
||||||
|
gotGlobalRequest(buf);
|
||||||
|
break;
|
||||||
case REQUEST_SUCCESS:
|
case REQUEST_SUCCESS:
|
||||||
gotGlobalReqResponse(buf);
|
gotGlobalReqResponse(buf);
|
||||||
break;
|
break;
|
||||||
@@ -259,6 +262,20 @@ public class ConnectionImpl
|
|||||||
channels.clear();
|
channels.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void gotGlobalRequest(SSHPacket buf)
|
||||||
|
throws ConnectionException, TransportException {
|
||||||
|
try {
|
||||||
|
final String requestName = buf.readString();
|
||||||
|
boolean wantReply = buf.readBoolean();
|
||||||
|
log.debug("Received GLOBAL_REQUEST `{}`; want reply: {}", requestName, wantReply);
|
||||||
|
if (wantReply) {
|
||||||
|
trans.write(new SSHPacket(Message.REQUEST_FAILURE));
|
||||||
|
}
|
||||||
|
} catch (Buffer.BufferException be) {
|
||||||
|
throw new ConnectionException(be);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTimeoutMs(int timeoutMs) {
|
public void setTimeoutMs(int timeoutMs) {
|
||||||
this.timeoutMs = timeoutMs;
|
this.timeoutMs = timeoutMs;
|
||||||
|
|||||||
Reference in New Issue
Block a user