4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
|
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
|
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
|
logevent("Received X11 connect request");
/* Refuse if X11 forwarding is disabled. */
if (!ssh->X11_fwd_enabled) {
send_packet(ssh, SSH1_MSG_CHANNEL_OPEN_FAILURE,
PKT_INT, remoteid, PKT_END);
logevent("Rejected X11 connect request");
} else {
char *err;
c = snew(struct ssh_channel);
c->ssh = ssh;
if ((err = x11_init(&c->u.x11.xconn, ssh->x11authtree, c,
c->u.x11.xconn = x11_init(ssh->x11authtree, c, NULL, -1);
NULL, -1)) != NULL) {
logeventf(ssh, "Opening X11 forward connection failed: %s", err);
sfree(err);
sfree(c);
send_packet(ssh, SSH1_MSG_CHANNEL_OPEN_FAILURE,
PKT_INT, remoteid, PKT_END);
} else {
logevent
("Opening X11 forward connection succeeded");
c->remoteid = remoteid;
c->halfopen = FALSE;
c->localid = alloc_channel_id(ssh);
c->closes = 0;
c->pending_eof = FALSE;
c->throttling_conn = 0;
c->type = CHAN_X11; /* identify channel type */
add234(ssh->channels, c);
send_packet(ssh, SSH1_MSG_CHANNEL_OPEN_CONFIRMATION,
PKT_INT, c->remoteid, PKT_INT,
c->localid, PKT_END);
logevent("Opened X11 forward channel");
c->remoteid = remoteid;
c->halfopen = FALSE;
c->localid = alloc_channel_id(ssh);
c->closes = 0;
c->pending_eof = FALSE;
c->throttling_conn = 0;
c->type = CHAN_X11; /* identify channel type */
add234(ssh->channels, c);
send_packet(ssh, SSH1_MSG_CHANNEL_OPEN_CONFIRMATION,
PKT_INT, c->remoteid, PKT_INT,
c->localid, PKT_END);
logevent("Opened X11 forward channel");
}
}
}
static void ssh1_smsg_agent_open(Ssh ssh, struct Packet *pktin)
{
/* Remote side is trying to open a channel to talk to our
* agent. Give them back a local channel number. */
|
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
|
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
|
-
+
-
-
+
+
-
-
-
-
-
+
+
|
remid = ssh_pkt_getuint32(pktin);
winsize = ssh_pkt_getuint32(pktin);
pktsize = ssh_pkt_getuint32(pktin);
if (typelen == 3 && !memcmp(type, "x11", 3)) {
char *addrstr;
char *x11err;
ssh_pkt_getstring(pktin, &peeraddr, &peeraddrlen);
addrstr = snewn(peeraddrlen+1, char);
memcpy(addrstr, peeraddr, peeraddrlen);
addrstr[peeraddrlen] = '\0';
peerport = ssh_pkt_getuint32(pktin);
logeventf(ssh, "Received X11 connect request from %s:%d",
addrstr, peerport);
if (!ssh->X11_fwd_enabled)
error = "X11 forwarding is not enabled";
else {
else if ((x11err = x11_init(&c->u.x11.xconn, ssh->x11authtree, c,
addrstr, peerport)) != NULL) {
c->u.x11.xconn = x11_init(ssh->x11authtree, c,
addrstr, peerport);
logeventf(ssh, "Local X11 connection failed: %s", x11err);
sfree(x11err);
error = "Unable to open an X11 connection";
} else {
logevent("Opening X11 forward connection succeeded");
c->type = CHAN_X11;
logevent("Opened X11 forward channel");
}
sfree(addrstr);
} else if (typelen == 15 &&
!memcmp(type, "forwarded-tcpip", 15)) {
struct ssh_rportfwd pf, *realpf;
char *shost;
|