X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=portfwd.c;h=325e86870f426a35be2e1ce7438a1653cc8a9aab;hb=9dd9860cc84f82309de64c33e2813c6e9dc60749;hp=e3e63e39aafbb3355e0c3c5fbc465bbede9e823f;hpb=9cbcd176516db51658a55bfc8a37bd00938a70f0;p=PuTTY.git diff --git a/portfwd.c b/portfwd.c index e3e63e39..325e8687 100644 --- a/portfwd.c +++ b/portfwd.c @@ -157,6 +157,21 @@ static int pfl_closing(Plug plug, const char *error_msg, int error_code, return 1; } +static void wrap_send_port_open(void *channel, const char *hostname, int port, + Socket s) +{ + char *peerinfo, *description; + peerinfo = sk_peer_info(s); + if (peerinfo) { + description = dupprintf("forwarding from %s", peerinfo); + sfree(peerinfo); + } else { + description = dupstr("forwarding"); + } + ssh_send_port_open(channel, hostname, port, description); + sfree(description); +} + static int pfd_receive(Plug plug, int urgent, char *data, int len) { struct PortForwarding *pf = (struct PortForwarding *) plug; @@ -371,7 +386,7 @@ static int pfd_receive(Plug plug, int urgent, char *data, int len) return 1; } else { /* asks to forward to the specified host/port for this */ - ssh_send_port_open(pf->c, pf->hostname, pf->port, "forwarding"); + wrap_send_port_open(pf->c, pf->hostname, pf->port, pf->s); } pf->dynamic = 0; @@ -510,7 +525,7 @@ static int pfl_accepting(Plug p, accept_fn_t constructor, accept_ctx_t ctx) return 1; } else { /* asks to forward to the specified host/port for this */ - ssh_send_port_open(pf->c, pf->hostname, pf->port, "forwarding"); + wrap_send_port_open(pf->c, pf->hostname, pf->port, s); } }