void *frontend;
+ int ospeed, ispeed; /* temporaries */
int term_width, term_height;
tree234 *channels; /* indexed by local id */
if (s->authed)
break;
}
+ sfree(s->response);
}
if (s->authed)
break;
}
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;
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;
}
logeventf(ssh, "Initialised %s decompression",
ssh->sccomp->text_name);
freebn(s->f);
- freebn(s->g);
freebn(s->K);
- freebn(s->p);
+ if (ssh->kex == &ssh_diffiehellman_gex) {
+ freebn(s->g);
+ freebn(s->p);
+ }
/*
* If this is the first key exchange phase, we must pass the
s->method = 0;
ssh->pkt_ctx &= ~SSH2_PKTCTX_AUTH_MASK;
+ s->need_pw = FALSE;
/*
* Most password/passphrase prompts will be
if (s->authed)
continue;
}
+ sfree(s->response);
}
if (!s->method && s->can_pubkey && s->publickey_blob
ssh2_pkt_send(ssh);
s->type = AUTH_TYPE_PUBLICKEY;
+ key->alg->freekey(key->data);
}
} else if (s->method == AUTH_PASSWORD) {
/*
* 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");
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;
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;
ssh->csmac->free_context(ssh->cs_mac_ctx);
if (ssh->sc_mac_ctx)
ssh->scmac->free_context(ssh->sc_mac_ctx);
- if (ssh->cs_comp_ctx)
- ssh->cscomp->compress_cleanup(ssh->cs_comp_ctx);
- if (ssh->sc_comp_ctx)
- ssh->sccomp->compress_cleanup(ssh->sc_comp_ctx);
+ if (ssh->cs_comp_ctx) {
+ if (ssh->cscomp)
+ ssh->cscomp->compress_cleanup(ssh->cs_comp_ctx);
+ else
+ zlib_compress_cleanup(ssh->cs_comp_ctx);
+ }
+ if (ssh->sc_comp_ctx) {
+ if (ssh->sccomp)
+ ssh->sccomp->decompress_cleanup(ssh->sc_comp_ctx);
+ else
+ zlib_decompress_cleanup(ssh->sc_comp_ctx);
+ }
if (ssh->kex_ctx)
dh_cleanup(ssh->kex_ctx);
sfree(ssh->savedhost);