X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/75374b2f8b6f78b865555ba9e5588f46003d5da7..1388ecb1486e5763faf20f96e31bd69e918e2798:/ssh.c diff --git a/ssh.c b/ssh.c index 89fa7854..6c94ba49 100644 --- a/ssh.c +++ b/ssh.c @@ -573,6 +573,7 @@ struct ssh_tag { void *frontend; + int ospeed, ispeed; /* temporaries */ int term_width, term_height; tree234 *channels; /* indexed by local id */ @@ -2127,7 +2128,7 @@ static void ssh_sent(Plug plug, int bufsize) * freed by the caller. */ static const char *connect_to_host(Ssh ssh, char *host, int port, - char **realhost, int nodelay) + char **realhost, int nodelay, int keepalive) { static const struct plug_function_table fn_table = { ssh_closing, @@ -2168,7 +2169,7 @@ static const char *connect_to_host(Ssh ssh, char *host, int port, } ssh->fn = &fn_table; ssh->s = new_connection(addr, *realhost, port, - 0, 1, nodelay, (Plug) ssh, &ssh->cfg); + 0, 1, nodelay, keepalive, (Plug) ssh, &ssh->cfg); if ((err = sk_socket_error(ssh->s)) != NULL) { ssh->s = NULL; return err; @@ -3401,11 +3402,19 @@ static void ssh1_protocol(Ssh ssh, unsigned char *in, int inlen, int ispkt) } if (!ssh->cfg.nopty) { + /* Unpick the terminal-speed string. */ + /* XXX perhaps we should allow no speeds to be sent. */ + 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, PKT_CHAR, 0, PKT_END); + PKT_INT, 0, PKT_INT, 0, /* width,height in pixels */ + 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; @@ -3418,7 +3427,8 @@ static void ssh1_protocol(Ssh ssh, unsigned char *in, int inlen, int ispkt) c_write_str(ssh, "Server refused to allocate pty\r\n"); ssh->editing = ssh->echoing = 1; } - logevent("Allocated pty"); + logeventf(ssh, "Allocated pty (ospeed %dbps, ispeed %dbps)", + ssh->ospeed, ssh->ispeed); } else { ssh->editing = ssh->echoing = 1; } @@ -4982,9 +4992,11 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen, int ispkt) } else { s->need_pw = FALSE; } - c_write_str(ssh, "Authenticating with public key \""); - c_write_str(ssh, comment); - c_write_str(ssh, "\"\r\n"); + if (flags & FLAG_VERBOSE) { + c_write_str(ssh, "Authenticating with public key \""); + c_write_str(ssh, comment); + c_write_str(ssh, "\"\r\n"); + } s->method = AUTH_PUBLICKEY_FILE; } } @@ -5583,6 +5595,11 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen, int ispkt) * 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. */ + 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"); @@ -5593,7 +5610,11 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen, int ispkt) ssh2_pkt_adduint32(ssh, 0); /* pixel width */ ssh2_pkt_adduint32(ssh, 0); /* pixel height */ ssh2_pkt_addstring_start(ssh); - ssh2_pkt_addstring_data(ssh, "\0", 1); /* TTY_OP_END, no special options */ + ssh2_pkt_addbyte(ssh, 128); /* TTY_OP_ISPEED */ + ssh2_pkt_adduint32(ssh, ssh->ispeed); + ssh2_pkt_addbyte(ssh, 129); /* TTY_OP_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; @@ -5618,7 +5639,8 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen, int ispkt) c_write_str(ssh, "Server refused to allocate pty\r\n"); ssh->editing = ssh->echoing = 1; } else { - logevent("Allocated pty"); + logeventf(ssh, "Allocated pty (ospeed %dbps, ispeed %dbps)", + ssh->ospeed, ssh->ispeed); } } else { ssh->editing = ssh->echoing = 1; @@ -6161,7 +6183,8 @@ static void ssh2_protocol(Ssh ssh, unsigned char *in, int inlen, int ispkt) */ static const char *ssh_init(void *frontend_handle, void **backend_handle, Config *cfg, - char *host, int port, char **realhost, int nodelay) + char *host, int port, char **realhost, int nodelay, + int keepalive) { const char *p; Ssh ssh; @@ -6245,7 +6268,7 @@ static const char *ssh_init(void *frontend_handle, void **backend_handle, ssh->protocol = NULL; - p = connect_to_host(ssh, host, port, realhost, nodelay); + p = connect_to_host(ssh, host, port, realhost, nodelay, keepalive); if (p != NULL) return p;