зеркало из https://github.com/github/putty.git
Pass an error message through to sshfwd_unclean_close.
We have access to one at every call site, so there's really no reason not to send it through to ssh.c to be logged. [originally from svn r10038]
This commit is contained in:
Родитель
1472aa2a26
Коммит
8e7b0d0e4b
|
@ -88,7 +88,7 @@ static int pfd_closing(Plug plug, const char *error_msg, int error_code,
|
|||
* Socket error. Slam the connection instantly shut.
|
||||
*/
|
||||
if (pr->c) {
|
||||
sshfwd_unclean_close(pr->c);
|
||||
sshfwd_unclean_close(pr->c, error_msg);
|
||||
} else {
|
||||
/*
|
||||
* We might not have an SSH channel, if a socket error
|
||||
|
|
7
ssh.c
7
ssh.c
|
@ -4302,7 +4302,7 @@ void sshfwd_write_eof(struct ssh_channel *c)
|
|||
ssh_channel_try_eof(c);
|
||||
}
|
||||
|
||||
void sshfwd_unclean_close(struct ssh_channel *c)
|
||||
void sshfwd_unclean_close(struct ssh_channel *c, const char *err)
|
||||
{
|
||||
Ssh ssh = c->ssh;
|
||||
|
||||
|
@ -4312,12 +4312,13 @@ void sshfwd_unclean_close(struct ssh_channel *c)
|
|||
switch (c->type) {
|
||||
case CHAN_X11:
|
||||
x11_close(c->u.x11.s);
|
||||
logevent("Forwarded X11 connection terminated due to local error");
|
||||
logeventf(ssh, "Forwarded X11 connection terminated due to local "
|
||||
"error: %s", err);
|
||||
break;
|
||||
case CHAN_SOCKDATA:
|
||||
case CHAN_SOCKDATA_DORMANT:
|
||||
pfd_close(c->u.pfd.s);
|
||||
logevent("Forwarded port closed due to local error");
|
||||
logeventf(ssh, "Forwarded port closed due to local error: %s", err);
|
||||
break;
|
||||
}
|
||||
c->type = CHAN_ZOMBIE;
|
||||
|
|
2
ssh.h
2
ssh.h
|
@ -11,7 +11,7 @@ struct ssh_channel;
|
|||
|
||||
extern int sshfwd_write(struct ssh_channel *c, char *, int);
|
||||
extern void sshfwd_write_eof(struct ssh_channel *c);
|
||||
extern void sshfwd_unclean_close(struct ssh_channel *c);
|
||||
extern void sshfwd_unclean_close(struct ssh_channel *c, const char *err);
|
||||
extern void sshfwd_unthrottle(struct ssh_channel *c, int bufsize);
|
||||
|
||||
/*
|
||||
|
|
2
x11fwd.c
2
x11fwd.c
|
@ -510,7 +510,7 @@ static int x11_closing(Plug plug, const char *error_msg, int error_code,
|
|||
/*
|
||||
* Socket error. Slam the connection instantly shut.
|
||||
*/
|
||||
sshfwd_unclean_close(pr->c);
|
||||
sshfwd_unclean_close(pr->c, error_msg);
|
||||
} else {
|
||||
/*
|
||||
* Ordinary EOF received on socket. Send an EOF on the SSH
|
||||
|
|
Загрузка…
Ссылка в новой задаче