1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

Reinstate the textual service name in port forwarding Event Log

messages where specified. (I had removed this in the previous
revision through forgetfulness.)

[originally from svn r5050]
This commit is contained in:
Simon Tatham 2004-12-30 17:53:26 +00:00
parent d006b68c5e
commit 44239efc6b

20
ssh.c
View File

@ -520,12 +520,14 @@ struct ssh_portfwd {
int type; int type;
unsigned sport, dport; unsigned sport, dport;
char *saddr, *daddr; char *saddr, *daddr;
char *sserv, *dserv;
struct ssh_rportfwd *remote; struct ssh_rportfwd *remote;
int addressfamily; int addressfamily;
void *local; void *local;
}; };
#define free_portfwd(pf) ( \ #define free_portfwd(pf) ( \
((pf) ? (sfree((pf)->saddr), sfree((pf)->daddr)) : (void)0 ), sfree(pf) ) ((pf) ? (sfree((pf)->saddr), sfree((pf)->daddr), \
sfree((pf)->sserv), sfree((pf)->dserv)) : (void)0 ), sfree(pf) )
struct Packet { struct Packet {
long length; long length;
@ -3784,8 +3786,10 @@ static void ssh_setup_portfwd(Ssh ssh, const Config *cfg)
pfrec = snew(struct ssh_portfwd); pfrec = snew(struct ssh_portfwd);
pfrec->type = type; pfrec->type = type;
pfrec->saddr = *saddr ? dupstr(saddr) : NULL; pfrec->saddr = *saddr ? dupstr(saddr) : NULL;
pfrec->sserv = sserv ? dupstr(sports) : NULL;
pfrec->sport = sport; pfrec->sport = sport;
pfrec->daddr = *host ? dupstr(host) : NULL; pfrec->daddr = *host ? dupstr(host) : NULL;
pfrec->dserv = dserv ? dupstr(dports) : NULL;
pfrec->dport = dport; pfrec->dport = dport;
pfrec->local = NULL; pfrec->local = NULL;
pfrec->remote = NULL; pfrec->remote = NULL;
@ -3882,14 +3886,22 @@ static void ssh_setup_portfwd(Ssh ssh, const Config *cfg)
for (i = 0; (epf = index234(ssh->portfwds, i)) != NULL; i++) for (i = 0; (epf = index234(ssh->portfwds, i)) != NULL; i++)
if (epf->status == CREATE) { if (epf->status == CREATE) {
char *sportdesc, *dportdesc; char *sportdesc, *dportdesc;
sportdesc = dupprintf("%s%s%d", sportdesc = dupprintf("%s%s%s%s%d%s",
epf->saddr ? epf->saddr : "", epf->saddr ? epf->saddr : "",
epf->saddr ? ":" : "", epf->saddr ? ":" : "",
epf->sport); epf->sserv ? epf->sserv : "",
epf->sserv ? "(" : "",
epf->sport,
epf->sserv ? ")" : "");
if (epf->type == 'D') { if (epf->type == 'D') {
dportdesc = NULL; dportdesc = NULL;
} else { } else {
dportdesc = dupprintf("%s:%d", epf->daddr, epf->dport); dportdesc = dupprintf("%s:%s%s%d%s",
epf->daddr,
epf->dserv ? epf->dserv : "",
epf->dserv ? "(" : "",
epf->dport,
epf->dserv ? ")" : "");
} }
if (epf->type == 'L') { if (epf->type == 'L') {