mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-27 02:02:26 +00:00
Unconditionally fill the SSH-1 dispatch table.
In SSH-2, every possible packet type code has a non-NULL entry in the dispatch table, even if most of them are just ssh2_msg_unimplemented. In SSH-1, some dispatch table entries are NULL, which means that the code processing the dispatch table has to have some SSH-1 specific fallback logic. Now I've put the fallback logic in a separate function, and replaced the NULL table entries with pointers to that function, so that another pointless difference between the SSH-1 and SSH-2 code is removed.
This commit is contained in:
parent
0ce92248a0
commit
0a15a2c471
16
ssh.c
16
ssh.c
@ -6268,15 +6268,25 @@ static void ssh_msg_ignore(Ssh ssh, struct Packet *pktin)
|
|||||||
/* Do nothing, because we're ignoring it! Duhh. */
|
/* Do nothing, because we're ignoring it! Duhh. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ssh1_coro_wrapper(Ssh ssh, struct Packet *pktin)
|
||||||
|
{
|
||||||
|
if (!ssh->protocol_initial_phase_done) {
|
||||||
|
if (do_ssh1_login(ssh, NULL, 0, pktin))
|
||||||
|
ssh->protocol_initial_phase_done = TRUE;
|
||||||
|
} else {
|
||||||
|
do_ssh1_connection(ssh, NULL, 0, pktin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void ssh1_protocol_setup(Ssh ssh)
|
static void ssh1_protocol_setup(Ssh ssh)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Most messages are handled by the coroutines.
|
* Most messages are handled by the main protocol routine.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
ssh->packet_dispatch[i] = NULL;
|
ssh->packet_dispatch[i] = ssh1_coro_wrapper;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These special message types we install handlers for.
|
* These special message types we install handlers for.
|
||||||
@ -6293,7 +6303,7 @@ static void ssh1_protocol(Ssh ssh, const void *vin, int inlen,
|
|||||||
if (ssh->state == SSH_STATE_CLOSED)
|
if (ssh->state == SSH_STATE_CLOSED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pktin && ssh->packet_dispatch[pktin->type]) {
|
if (pktin) {
|
||||||
ssh->packet_dispatch[pktin->type](ssh, pktin);
|
ssh->packet_dispatch[pktin->type](ssh, pktin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user