X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/fab893b6cac31863187aed38740cb302a3c42193..36b8d9bb9274b5ca088063a83d255121691a579f:/portfwd.c diff --git a/portfwd.c b/portfwd.c index 8ef1761b..00132ec6 100644 --- a/portfwd.c +++ b/portfwd.c @@ -86,7 +86,7 @@ struct PFwdPrivate { int buflen; }; -static int pfd_closing(Plug plug, char *error_msg, int error_code, +static int pfd_closing(Plug plug, const char *error_msg, int error_code, int calling_back) { struct PFwdPrivate *pr = (struct PFwdPrivate *) plug; @@ -220,7 +220,7 @@ static int pfd_receive(Plug plug, int urgent, char *data, int len) } if (pr->dynamic == 0x5001) { - int atype, alen; + int atype, alen = 0; if (pr->port < 6) continue; atype = (unsigned char)pr->hostname[3]; if (atype == 1) /* IPv4 address */ @@ -331,8 +331,8 @@ static void pfd_sent(Plug plug, int bufsize) /* * Called when receiving a PORT OPEN from the server */ -char *pfd_newconnect(Socket *s, char *hostname, int port, void *c, - const Config *cfg) +const char *pfd_newconnect(Socket *s, char *hostname, int port, + void *c, const Config *cfg) { static const struct plug_function_table fn_table = { pfd_closing, @@ -342,7 +342,8 @@ char *pfd_newconnect(Socket *s, char *hostname, int port, void *c, }; SockAddr addr; - char *err, *dummy_realhost; + const char *err; + char *dummy_realhost; struct PFwdPrivate *pr; /* @@ -362,6 +363,7 @@ char *pfd_newconnect(Socket *s, char *hostname, int port, void *c, pr->ready = 1; pr->c = c; pr->backhandle = NULL; /* we shouldn't need this */ + pr->dynamic = 0; pr->s = *s = new_connection(addr, dummy_realhost, port, 0, 1, 0, (Plug) pr, cfg); @@ -379,7 +381,7 @@ char *pfd_newconnect(Socket *s, char *hostname, int port, void *c, called when someone connects to the local port */ -static int pfd_accepting(Plug p, void *sock) +static int pfd_accepting(Plug p, OSSocket sock) { static const struct plug_function_table fn_table = { pfd_closing, @@ -389,7 +391,7 @@ static int pfd_accepting(Plug p, void *sock) }; struct PFwdPrivate *pr, *org; Socket s; - char *err; + const char *err; org = (struct PFwdPrivate *)p; pr = snew(struct PFwdPrivate); @@ -415,6 +417,7 @@ static int pfd_accepting(Plug p, void *sock) pr->port = 0; /* hostname buffer is so far empty */ sk_set_frozen(s, 0); /* we want to receive SOCKS _now_! */ } else { + pr->dynamic = 0; strcpy(pr->hostname, org->hostname); pr->port = org->port; pr->c = new_sock_channel(org->backhandle, s); @@ -435,8 +438,8 @@ 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 (srcaddr:)port */ -char *pfd_addforward(char *desthost, int destport, char *srcaddr, int port, - void *backhandle, const Config *cfg) +const char *pfd_addforward(char *desthost, int destport, char *srcaddr, + int port, void *backhandle, const Config *cfg) { static const struct plug_function_table fn_table = { pfd_closing, @@ -445,7 +448,7 @@ char *pfd_addforward(char *desthost, int destport, char *srcaddr, int port, pfd_accepting }; - char *err; + const char *err; struct PFwdPrivate *pr; Socket s;