1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-05 21:42:47 -05:00

Remove downstream remote port forwardings in ssh.c too.

Another piece of half-finished machinery that I can't have tested
properly when I set up connection sharing: I had the function
ssh_alloc_sharing_rportfwd which is how sshshare.c asks ssh.c to start
sending it channel-open requests for a given remote forwarded port,
but I had no companion function that removes one of those requests
again when a downstream remote port forwarding goes away (either by
mid-session cancel-tcpip-forward or by the whole downstream
disconnecting).

As a result, the _second_ attempt to set up the same remote port
forwarding, after a sharing downstream had done so once and then
stopped, would quietly fail.
This commit is contained in:
Simon Tatham
2018-06-03 07:54:00 +01:00
parent 314c8f5270
commit 3f1f7c3ce7
3 changed files with 25 additions and 0 deletions

15
ssh.c
View File

@ -5236,6 +5236,21 @@ int ssh_alloc_sharing_rportfwd(Ssh ssh, const char *shost, int sport,
return TRUE;
}
void ssh_remove_sharing_rportfwd(Ssh ssh, const char *shost, int sport,
void *share_ctx)
{
struct ssh_rportfwd pf, *realpf;
assert(ssh->rportfwds);
pf.shost = dupstr(shost);
pf.sport = sport;
realpf = del234(ssh->rportfwds, &pf);
assert(realpf);
assert(realpf->share_ctx == share_ctx);
sfree(realpf->shost);
sfree(realpf);
}
static void ssh_sharing_global_request_response(Ssh ssh, struct Packet *pktin,
void *ctx)
{