=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/packet.c,v retrieving revision 1.164 retrieving revision 1.165 diff -u -r1.164 -r1.165 --- src/usr.bin/ssh/packet.c 2009/06/12 20:43:22 1.164 +++ src/usr.bin/ssh/packet.c 2009/06/12 20:58:32 1.165 @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.164 2009/06/12 20:43:22 andreas Exp $ */ +/* $OpenBSD: packet.c,v 1.165 2009/06/12 20:58:32 andreas Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -178,6 +178,15 @@ /* Used in packet_read_poll2() */ u_int packlen; + /* Used in packet_send2 */ + int rekeying; + + /* Used in packet_set_interactive */ + int set_interactive_called; + + /* Used in packet_set_maxsize */ + int set_maxsize_called; + TAILQ_HEAD(, packet) outgoing; }; @@ -941,7 +950,6 @@ static void packet_send2(void) { - static int rekeying = 0; struct packet *p; u_char type, *cp; @@ -949,7 +957,7 @@ type = cp[5]; /* during rekeying we can only send key exchange messages */ - if (rekeying) { + if (active_state->rekeying) { if (!((type >= SSH2_MSG_TRANSPORT_MIN) && (type <= SSH2_MSG_TRANSPORT_MAX))) { debug("enqueue packet: %u", type); @@ -965,13 +973,13 @@ /* rekeying starts with sending KEXINIT */ if (type == SSH2_MSG_KEXINIT) - rekeying = 1; + active_state->rekeying = 1; packet_send2_wrapped(); /* after a NEWKEYS message we can send the complete queue */ if (type == SSH2_MSG_NEWKEYS) { - rekeying = 0; + active_state->rekeying = 0; while ((p = TAILQ_FIRST(&active_state->outgoing))) { type = p->type; debug("dequeue packet: %u", type); @@ -1726,11 +1734,9 @@ void packet_set_interactive(int interactive) { - static int called = 0; - - if (called) + if (active_state->set_interactive_called) return; - called = 1; + active_state->set_interactive_called = 1; /* Record that we are in interactive mode. */ active_state->interactive_mode = interactive; @@ -1753,9 +1759,7 @@ int packet_set_maxsize(u_int s) { - static int called = 0; - - if (called) { + if (active_state->set_maxsize_called) { logit("packet_set_maxsize: called twice: old %d new %d", active_state->max_packet_size, s); return -1; @@ -1764,7 +1768,7 @@ logit("packet_set_maxsize: bad size %d", s); return -1; } - called = 1; + active_state->set_maxsize_called = 1; debug("packet_set_maxsize: setting to %d", s); active_state->max_packet_size = s; return s;