From 09d133f3aa04b42a52ae13fd4ba25e80bee5ebf0 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 23 Apr 2009 17:33:42 +0000 Subject: [PATCH] When starting a SOCKS connection in dynamic forwarding, freeze the local socket _before_ calling the SSH setup functions. This makes no difference to ssh.c itself, but it makes portfwd.c easier to reuse for other purposes (e.g. as a component of a standalone SOCKS server), because now ssh_send_port_open() can itself call pfd_confirm() without the freeze and unfreeze happening in the wrong order. git-svn-id: svn://svn.tartarus.org/sgt/putty@8500 cda61777-01e9-0310-a592-d414129be87e --- portfwd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/portfwd.c b/portfwd.c index e6cf2005..662d995d 100644 --- a/portfwd.c +++ b/portfwd.c @@ -278,6 +278,12 @@ static int pfd_receive(Plug plug, int urgent, char *data, int len) */ connect: + /* + * Freeze the socket until the SSH server confirms the + * connection. + */ + sk_set_frozen(pr->s, 1); + pr->c = new_sock_channel(pr->backhandle, pr->s); if (pr->c == NULL) { pfd_close(pr->s); @@ -289,11 +295,6 @@ static int pfd_receive(Plug plug, int urgent, char *data, int len) pr->dynamic = 0; /* - * Now freeze the socket until the SSH server confirms the - * connection. - */ - sk_set_frozen(pr->s, 1); - /* * If there's any data remaining in our current buffer, * save it to be sent on pfd_confirm(). */ -- 2.11.0