Diff

Differences From Artifact [d812fdb51b]:

To Artifact [e656b52f13]:


5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854


5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873


5874
5875
5876
5877
5878
5879
5880
                    ssh2_pkt_send(ssh);
		}
	    } else if (ssh->pktin.type == SSH2_MSG_CHANNEL_OPEN) {
		char *type;
		int typelen;
		char *peeraddr;
		int peeraddrlen;
		int port;
		char *error = NULL;
		struct ssh_channel *c;
		unsigned remid, winsize, pktsize;
		ssh2_pkt_getstring(ssh, &type, &typelen);
		c = snew(struct ssh_channel);
		c->ssh = ssh;

		remid = ssh2_pkt_getuint32(ssh);
		winsize = ssh2_pkt_getuint32(ssh);
		pktsize = ssh2_pkt_getuint32(ssh);
		ssh2_pkt_getstring(ssh, &peeraddr, &peeraddrlen);
		port = ssh2_pkt_getuint32(ssh);

		if (typelen == 3 && !memcmp(type, "x11", 3)) {
		    char *addrstr = snewn(peeraddrlen+1, char);
		    memcpy(addrstr, peeraddr, peeraddrlen);
		    peeraddr[peeraddrlen] = '\0';



		    if (!ssh->X11_fwd_enabled)
			error = "X11 forwarding is not enabled";
		    else if (x11_init(&c->u.x11.s, ssh->cfg.x11_display, c,
				      ssh->x11auth, addrstr, port,
				      &ssh->cfg) != NULL) {
			error = "Unable to open an X11 connection";
		    } else {
			c->type = CHAN_X11;
		    }

		    sfree(addrstr);
		} else if (typelen == 15 &&
			   !memcmp(type, "forwarded-tcpip", 15)) {
		    struct ssh_rportfwd pf, *realpf;
		    char *dummy;
		    int dummylen;
		    ssh2_pkt_getstring(ssh, &dummy, &dummylen);/* skip address */
		    pf.sport = ssh2_pkt_getuint32(ssh);


		    realpf = find234(ssh->rportfwds, &pf, NULL);
		    if (realpf == NULL) {
			error = "Remote port is not recognised";
		    } else {
			char *e = pfd_newconnect(&c->u.pfd.s, realpf->dhost,
						 realpf->dport, c, &ssh->cfg);
			logeventf(ssh, "Received remote port open request"







|










<
<





>
>




|














>
>







5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847


5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
                    ssh2_pkt_send(ssh);
		}
	    } else if (ssh->pktin.type == SSH2_MSG_CHANNEL_OPEN) {
		char *type;
		int typelen;
		char *peeraddr;
		int peeraddrlen;
		int peerport;
		char *error = NULL;
		struct ssh_channel *c;
		unsigned remid, winsize, pktsize;
		ssh2_pkt_getstring(ssh, &type, &typelen);
		c = snew(struct ssh_channel);
		c->ssh = ssh;

		remid = ssh2_pkt_getuint32(ssh);
		winsize = ssh2_pkt_getuint32(ssh);
		pktsize = ssh2_pkt_getuint32(ssh);



		if (typelen == 3 && !memcmp(type, "x11", 3)) {
		    char *addrstr = snewn(peeraddrlen+1, char);
		    memcpy(addrstr, peeraddr, peeraddrlen);
		    peeraddr[peeraddrlen] = '\0';
                    ssh2_pkt_getstring(ssh, &peeraddr, &peeraddrlen);
                    peerport = ssh2_pkt_getuint32(ssh);

		    if (!ssh->X11_fwd_enabled)
			error = "X11 forwarding is not enabled";
		    else if (x11_init(&c->u.x11.s, ssh->cfg.x11_display, c,
				      ssh->x11auth, addrstr, peerport,
				      &ssh->cfg) != NULL) {
			error = "Unable to open an X11 connection";
		    } else {
			c->type = CHAN_X11;
		    }

		    sfree(addrstr);
		} else if (typelen == 15 &&
			   !memcmp(type, "forwarded-tcpip", 15)) {
		    struct ssh_rportfwd pf, *realpf;
		    char *dummy;
		    int dummylen;
		    ssh2_pkt_getstring(ssh, &dummy, &dummylen);/* skip address */
		    pf.sport = ssh2_pkt_getuint32(ssh);
                    ssh2_pkt_getstring(ssh, &peeraddr, &peeraddrlen);
                    peerport = ssh2_pkt_getuint32(ssh);
		    realpf = find234(ssh->rportfwds, &pf, NULL);
		    if (realpf == NULL) {
			error = "Remote port is not recognised";
		    } else {
			char *e = pfd_newconnect(&c->u.pfd.s, realpf->dhost,
						 realpf->dport, c, &ssh->cfg);
			logeventf(ssh, "Received remote port open request"