shithub: riscv

Download patch

ref: 2a266430e3fbae4eac97182e04dbd91f275a1b3c
parent: 615f43b76e5f67c2e737c6b039df48ffccd1fde3
author: cinap_lenrek <[email protected]>
date: Thu Nov 8 17:00:07 EST 2018

ssh: handle MSG_GOBAL_REQUEST

respond to MSG_GLOBAL_REQUEST with MSG_REQUEST_FAILURE
as stated by rfc4254 when server wants a reply.

failing todo so breaks some proprietary keep-alive schemes.

--- a/sys/src/cmd/ssh.c
+++ b/sys/src/cmd/ssh.c
@@ -961,7 +961,13 @@
 
 	switch(recv.r[0]){
 	case MSG_IGNORE:
+		return;
 	case MSG_GLOBAL_REQUEST:
+		if(unpack(recv.r, recv.w-recv.r, "_sb", &s, &n, &b) < 0)
+			break;
+		if(debug)
+			fprint(2, "%s: ignoring global request %.*s\n", argv0, n, s);
+		if(b != 0) sendpkt("b", MSG_REQUEST_FAILURE);
 		return;
 	case MSG_DISCONNECT:
 		if(unpack(recv.r, recv.w-recv.r, "_us", &c, &s, &n) < 0)