Diff

Differences From Artifact [26767234d7]:

To Artifact [4485f9c6e7]:


569
570
571
572
573
574
575

576
577
578
579
580
581
582
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583







+







    char *savedhost;
    int savedport;
    int send_ok;
    int echoing, editing;

    void *frontend;

    int ospeed, ispeed;		       /* temporaries */
    int term_width, term_height;

    tree234 *channels;		       /* indexed by local id */
    struct ssh_channel *mainchan;      /* primary session channel */
    int exitcode;

    tree234 *rportfwds;
3399
3400
3401
3402
3403
3404
3405
3406
3407


3408
3409
3410
3411
3412
3413
3414
3415


3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430

3431
3432
3433
3434
3435
3436
3437
3400
3401
3402
3403
3404
3405
3406


3407
3408
3409
3410
3411
3412
3413
3414


3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430

3431
3432
3433
3434
3435
3436
3437
3438







-
-
+
+






-
-
+
+














-
+







	    }
	}
    }

    if (!ssh->cfg.nopty) {
	/* Unpick the terminal-speed string. */
	/* XXX perhaps we should allow no speeds to be sent. */
	int ospeed = 38400, ispeed = 38400; /* last-resort defaults */
	sscanf(ssh->cfg.termspeed, "%d,%d", &ospeed, &ispeed);
	ssh->ospeed = 38400; ssh->ispeed = 38400; /* last-resort defaults */
	sscanf(ssh->cfg.termspeed, "%d,%d", &ssh->ospeed, &ssh->ispeed);
	/* Send the pty request. */
	send_packet(ssh, SSH1_CMSG_REQUEST_PTY,
		    PKT_STR, ssh->cfg.termtype,
		    PKT_INT, ssh->term_height,
		    PKT_INT, ssh->term_width,
		    PKT_INT, 0, PKT_INT, 0, /* width,height in pixels */
		    PKT_CHAR, 192, PKT_INT, ispeed, /* TTY_OP_ISPEED */
		    PKT_CHAR, 193, PKT_INT, ospeed, /* TTY_OP_OSPEED */
		    PKT_CHAR, 192, PKT_INT, ssh->ispeed, /* TTY_OP_ISPEED */
		    PKT_CHAR, 193, PKT_INT, ssh->ospeed, /* TTY_OP_OSPEED */
		    PKT_CHAR, 0, PKT_END);
	ssh->state = SSH_STATE_INTERMED;
	do {
	    crReturnV;
	} while (!ispkt);
	if (ssh->pktin.type != SSH1_SMSG_SUCCESS
	    && ssh->pktin.type != SSH1_SMSG_FAILURE) {
	    bombout(("Protocol confusion"));
	    crStopV;
	} else if (ssh->pktin.type == SSH1_SMSG_FAILURE) {
	    c_write_str(ssh, "Server refused to allocate pty\r\n");
	    ssh->editing = ssh->echoing = 1;
	}
	logeventf(ssh, "Allocated pty (ospeed %dbps, ispeed %dbps)",
		  ospeed, ispeed);
		  ssh->ospeed, ssh->ispeed);
    } else {
	ssh->editing = ssh->echoing = 1;
    }

    if (ssh->cfg.compression) {
	send_packet(ssh, SSH1_CMSG_REQUEST_COMPRESSION, PKT_INT, 6, PKT_END);
	do {
5590
5591
5592
5593
5594
5595
5596
5597
5598


5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611

5612
5613

5614
5615
5616
5617
5618
5619
5620
5591
5592
5593
5594
5595
5596
5597


5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611

5612
5613

5614
5615
5616
5617
5618
5619
5620
5621







-
-
+
+












-
+

-
+








    /*
     * Now allocate a pty for the session.
     */
    if (!ssh->cfg.nopty) {
	/* Unpick the terminal-speed string. */
	/* XXX perhaps we should allow no speeds to be sent. */
	int ospeed = 38400, ispeed = 38400; /* last-resort defaults */
	sscanf(ssh->cfg.termspeed, "%d,%d", &ospeed, &ispeed);
        ssh->ospeed = 38400; ssh->ispeed = 38400; /* last-resort defaults */
	sscanf(ssh->cfg.termspeed, "%d,%d", &ssh->ospeed, &ssh->ispeed);
	/* Build the pty request. */
	ssh2_pkt_init(ssh, SSH2_MSG_CHANNEL_REQUEST);
	ssh2_pkt_adduint32(ssh, ssh->mainchan->remoteid);	/* recipient channel */
	ssh2_pkt_addstring(ssh, "pty-req");
	ssh2_pkt_addbool(ssh, 1);	       /* want reply */
	ssh2_pkt_addstring(ssh, ssh->cfg.termtype);
	ssh2_pkt_adduint32(ssh, ssh->term_width);
	ssh2_pkt_adduint32(ssh, ssh->term_height);
	ssh2_pkt_adduint32(ssh, 0);	       /* pixel width */
	ssh2_pkt_adduint32(ssh, 0);	       /* pixel height */
	ssh2_pkt_addstring_start(ssh);
	ssh2_pkt_addbyte(ssh, 128);	       /* TTY_OP_ISPEED */
	ssh2_pkt_adduint32(ssh, ispeed);
	ssh2_pkt_adduint32(ssh, ssh->ispeed);
	ssh2_pkt_addbyte(ssh, 129);	       /* TTY_OP_OSPEED */
	ssh2_pkt_adduint32(ssh, ospeed);
	ssh2_pkt_adduint32(ssh, ssh->ospeed);
	ssh2_pkt_addstring_data(ssh, "\0", 1); /* TTY_OP_END */
	ssh2_pkt_send(ssh);
	ssh->state = SSH_STATE_INTERMED;

	do {
	    crWaitUntilV(ispkt);
	    if (ssh->pktin.type == SSH2_MSG_CHANNEL_WINDOW_ADJUST) {
5633
5634
5635
5636
5637
5638
5639
5640

5641
5642
5643
5644
5645
5646
5647
5634
5635
5636
5637
5638
5639
5640

5641
5642
5643
5644
5645
5646
5647
5648







-
+







			 " packet type %d", ssh->pktin.type));
		crStopV;
	    }
	    c_write_str(ssh, "Server refused to allocate pty\r\n");
	    ssh->editing = ssh->echoing = 1;
	} else {
	    logeventf(ssh, "Allocated pty (ospeed %dbps, ispeed %dbps)",
		      ospeed, ispeed);
		      ssh->ospeed, ssh->ispeed);
	}
    } else {
	ssh->editing = ssh->echoing = 1;
    }

    /*
     * Start a shell or a remote command. We may have to attempt