summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--packet.c30
2 files changed, 21 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 7df6881d7..862d55eaa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -93,6 +93,10 @@
93 Fix warnings found by chl@ and djm@ and change roaming_atomicio's 93 Fix warnings found by chl@ and djm@ and change roaming_atomicio's
94 return type to match atomicio's 94 return type to match atomicio's
95 Diff from djm@, ok markus@ 95 Diff from djm@, ok markus@
96 - andreas@cvs.openbsd.org 2009/06/12 20:58:32
97 [packet.c]
98 Move some more statics into session_state
99 ok markus@ djm@
96 100
9720090616 10120090616
98 - (dtucker) [configure.ac defines.h] Bug #1607: handle the case where fsid_t 102 - (dtucker) [configure.ac defines.h] Bug #1607: handle the case where fsid_t
diff --git a/packet.c b/packet.c
index f74fe52e3..0e9993b5a 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.164 2009/06/12 20:43:22 andreas Exp $ */ 1/* $OpenBSD: packet.c,v 1.165 2009/06/12 20:58:32 andreas Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -182,6 +182,15 @@ struct session_state {
182 /* Used in packet_read_poll2() */ 182 /* Used in packet_read_poll2() */
183 u_int packlen; 183 u_int packlen;
184 184
185 /* Used in packet_send2 */
186 int rekeying;
187
188 /* Used in packet_set_interactive */
189 int set_interactive_called;
190
191 /* Used in packet_set_maxsize */
192 int set_maxsize_called;
193
185 TAILQ_HEAD(, packet) outgoing; 194 TAILQ_HEAD(, packet) outgoing;
186}; 195};
187 196
@@ -950,7 +959,6 @@ packet_send2_wrapped(void)
950static void 959static void
951packet_send2(void) 960packet_send2(void)
952{ 961{
953 static int rekeying = 0;
954 struct packet *p; 962 struct packet *p;
955 u_char type, *cp; 963 u_char type, *cp;
956 964
@@ -958,7 +966,7 @@ packet_send2(void)
958 type = cp[5]; 966 type = cp[5];
959 967
960 /* during rekeying we can only send key exchange messages */ 968 /* during rekeying we can only send key exchange messages */
961 if (rekeying) { 969 if (active_state->rekeying) {
962 if (!((type >= SSH2_MSG_TRANSPORT_MIN) && 970 if (!((type >= SSH2_MSG_TRANSPORT_MIN) &&
963 (type <= SSH2_MSG_TRANSPORT_MAX))) { 971 (type <= SSH2_MSG_TRANSPORT_MAX))) {
964 debug("enqueue packet: %u", type); 972 debug("enqueue packet: %u", type);
@@ -974,13 +982,13 @@ packet_send2(void)
974 982
975 /* rekeying starts with sending KEXINIT */ 983 /* rekeying starts with sending KEXINIT */
976 if (type == SSH2_MSG_KEXINIT) 984 if (type == SSH2_MSG_KEXINIT)
977 rekeying = 1; 985 active_state->rekeying = 1;
978 986
979 packet_send2_wrapped(); 987 packet_send2_wrapped();
980 988
981 /* after a NEWKEYS message we can send the complete queue */ 989 /* after a NEWKEYS message we can send the complete queue */
982 if (type == SSH2_MSG_NEWKEYS) { 990 if (type == SSH2_MSG_NEWKEYS) {
983 rekeying = 0; 991 active_state->rekeying = 0;
984 while ((p = TAILQ_FIRST(&active_state->outgoing))) { 992 while ((p = TAILQ_FIRST(&active_state->outgoing))) {
985 type = p->type; 993 type = p->type;
986 debug("dequeue packet: %u", type); 994 debug("dequeue packet: %u", type);
@@ -1737,11 +1745,9 @@ packet_set_tos(int interactive)
1737void 1745void
1738packet_set_interactive(int interactive) 1746packet_set_interactive(int interactive)
1739{ 1747{
1740 static int called = 0; 1748 if (active_state->set_interactive_called)
1741
1742 if (called)
1743 return; 1749 return;
1744 called = 1; 1750 active_state->set_interactive_called = 1;
1745 1751
1746 /* Record that we are in interactive mode. */ 1752 /* Record that we are in interactive mode. */
1747 active_state->interactive_mode = interactive; 1753 active_state->interactive_mode = interactive;
@@ -1764,9 +1770,7 @@ packet_is_interactive(void)
1764int 1770int
1765packet_set_maxsize(u_int s) 1771packet_set_maxsize(u_int s)
1766{ 1772{
1767 static int called = 0; 1773 if (active_state->set_maxsize_called) {
1768
1769 if (called) {
1770 logit("packet_set_maxsize: called twice: old %d new %d", 1774 logit("packet_set_maxsize: called twice: old %d new %d",
1771 active_state->max_packet_size, s); 1775 active_state->max_packet_size, s);
1772 return -1; 1776 return -1;
@@ -1775,7 +1779,7 @@ packet_set_maxsize(u_int s)
1775 logit("packet_set_maxsize: bad size %d", s); 1779 logit("packet_set_maxsize: bad size %d", s);
1776 return -1; 1780 return -1;
1777 } 1781 }
1778 called = 1; 1782 active_state->set_maxsize_called = 1;
1779 debug("packet_set_maxsize: setting to %d", s); 1783 debug("packet_set_maxsize: setting to %d", s);
1780 active_state->max_packet_size = s; 1784 active_state->max_packet_size = s;
1781 return s; 1785 return s;