Support for doing DNS at the proxy end. I've invented a new type of
[u/mdw/putty] / portfwd.c
index a153d08..dc865f6 100644 (file)
--- a/portfwd.c
+++ b/portfwd.c
@@ -1,4 +1,3 @@
-#include <windows.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -127,7 +126,7 @@ char *pfd_newconnect(Socket *s, char *hostname, int port, void *c)
     /*
      * Try to find host.
      */
-    addr = sk_namelookup(hostname, &dummy_realhost);
+    addr = name_lookup(hostname, port, &dummy_realhost);
     if ((err = sk_addr_error(addr)))
        return err;
 
@@ -204,9 +203,10 @@ static int pfd_accepting(Plug p, void *sock)
 
 
 /* Add a new forwarding from port -> desthost:destport
- sets up a listener on the local machine on port
+ sets up a listener on the local machine on (srcaddr:)port
  */
-char *pfd_addforward(char *desthost, int destport, int port, void *backhandle)
+char *pfd_addforward(char *desthost, int destport, char *srcaddr, int port,
+                    void *backhandle)
 {
     static struct plug_function_table fn_table = {
        pfd_closing,
@@ -232,7 +232,7 @@ char *pfd_addforward(char *desthost, int destport, int port, void *backhandle)
     pr->waiting = NULL;
     pr->backhandle = backhandle;
 
-    pr->s = s = new_listener(port, (Plug) pr, !cfg.lport_acceptall);
+    pr->s = s = new_listener(srcaddr, port, (Plug) pr, !cfg.lport_acceptall);
     if ((err = sk_socket_error(s))) {
        sfree(pr);
        return err;