diff options
author | Matt Johnston <matt@ucc.asn.au> | 2007-07-27 17:13:42 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2007-07-27 17:13:42 +0000 |
commit | 57ae0bfedfaa475c4c49621fd4e2b168b5c73d50 (patch) | |
tree | 917c86e7cd2aad89269abafe703704afc4e6370e /common-session.c | |
parent | 993f58900dd0cdadee4d015e38c587342fa9e67a (diff) |
Prevent invalid packets being sent during key-exchange, instead queue
them until afterwards. This could sometimes terminate connections
after 8 hours if (for example) a new TCP forwarded connection
was sent at the KEX timeout.
--HG--
extra : convert_revision : 48426bd66b8f5ba50045f7ba190d1672745132e2
Diffstat (limited to 'common-session.c')
-rw-r--r-- | common-session.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/common-session.c b/common-session.c index b5adad2..9b248cf 100644 --- a/common-session.c +++ b/common-session.c @@ -80,9 +80,12 @@ void common_session_init(int sock, char* remotehost) { initqueue(&ses.writequeue); ses.requirenext = SSH_MSG_KEXINIT; - ses.dataallowed = 0; /* don't send data yet, we'll wait until after kex */ + ses.dataallowed = 1; /* we can send data until we actually + send the SSH_MSG_KEXINIT */ ses.ignorenext = 0; ses.lastpacket = 0; + ses.reply_queue_head = NULL; + ses.reply_queue_tail = NULL; /* set all the algos to none */ ses.keys = (struct key_context*)m_malloc(sizeof(struct key_context)); @@ -192,6 +195,10 @@ void session_loop(void(*loophandler)()) { process_packet(); } } + + /* if required, flush out any queued reply packets that + were being held up during a KEX */ + maybe_flush_reply_queue(); /* process pipes etc for the channels, ses.dataallowed == 0 * during rekeying ) */ |