changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: ssh: handle unknown MSG_CHANNE_REQUEST messages

changeset 6876: 12f6b6fbac27
parent 6875: 04ab30b6cf1c
child 6877: 81f788b3708f
child 6881: 8b9309f408bc
author: cinap_lenrek@felloff.net
date: Thu, 08 Nov 2018 22:35:45 +0100
files: sys/src/cmd/ssh.c
description: ssh: handle unknown MSG_CHANNE_REQUEST messages
     1.1--- a/sys/src/cmd/ssh.c
     1.2+++ b/sys/src/cmd/ssh.c
     1.3@@ -966,8 +966,9 @@ dispatch(void)
     1.4 		if(unpack(recv.r, recv.w-recv.r, "_sb", &s, &n, &b) < 0)
     1.5 			break;
     1.6 		if(debug)
     1.7-			fprint(2, "%s: ignoring global request %.*s\n", argv0, n, s);
     1.8-		if(b != 0) sendpkt("b", MSG_REQUEST_FAILURE);
     1.9+			fprint(2, "%s: global request: %.*s\n", argv0, n, s);
    1.10+		if(b != 0)
    1.11+			sendpkt("b", MSG_REQUEST_FAILURE);
    1.12 		return;
    1.13 	case MSG_DISCONNECT:
    1.14 		if(unpack(recv.r, recv.w-recv.r, "_us", &c, &s, &n) < 0)
    1.15@@ -1025,14 +1026,20 @@ dispatch(void)
    1.16 				break;
    1.17 			if(n != 0 && status == nil)
    1.18 				status = smprint("%.*s", n, s);
    1.19+			c = MSG_CHANNEL_SUCCESS;
    1.20 		} else if(n == 11 && memcmp(s, "exit-status", n) == 0){
    1.21 			if(unpack(p, recv.w-p, "u", &n) < 0)
    1.22 				break;
    1.23 			if(n != 0 && status == nil)
    1.24 				status = smprint("%d", n);
    1.25-		} else if(debug) {
    1.26-			fprint(2, "%s: channel request: %.*s\n", argv0, n, s);
    1.27+			c = MSG_CHANNEL_SUCCESS;
    1.28+		} else {
    1.29+			if(debug)
    1.30+				fprint(2, "%s: channel request: %.*s\n", argv0, n, s);
    1.31+			c = MSG_CHANNEL_FAILURE;
    1.32 		}
    1.33+		if(b != 0)
    1.34+			sendpkt("bu", c, recv.chan);
    1.35 		return;
    1.36 	case MSG_CHANNEL_EOF:
    1.37 		recv.eof = 1;