SSH port forwarding is now configurable in mid-session. After doing
[u/mdw/putty] / portfwd.c
index b95e5ac..e6934d4 100644 (file)
--- a/portfwd.c
+++ b/portfwd.c
@@ -462,7 +462,8 @@ static int pfd_accepting(Plug p, OSSocket sock)
  sets up a listener on the local machine on (srcaddr:)port
  */
 const char *pfd_addforward(char *desthost, int destport, char *srcaddr,
-                          int port, void *backhandle, const Config *cfg)
+                          int port, void *backhandle, const Config *cfg,
+                          void **sockdata)
 {
     static const struct plug_function_table fn_table = {
        pfd_closing,
@@ -501,6 +502,8 @@ const char *pfd_addforward(char *desthost, int destport, char *srcaddr,
 
     sk_set_private_ptr(s, pr);
 
+    *sockdata = (void *)s;
+
     return NULL;
 }
 
@@ -519,6 +522,14 @@ void pfd_close(Socket s)
     sk_close(s);
 }
 
+/*
+ * Terminate a listener.
+ */
+void pfd_terminate(void *sv)
+{
+    pfd_close((Socket)sv);
+}
+
 void pfd_unthrottle(Socket s)
 {
     struct PFwdPrivate *pr;