]> asedeno.scripts.mit.edu Git - PuTTY_svn.git/commitdiff
Pass an error message through to sshfwd_unclean_close.
authorSimon Tatham <anakin@pobox.com>
Sun, 8 Sep 2013 07:14:56 +0000 (07:14 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 8 Sep 2013 07:14:56 +0000 (07:14 +0000)
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.

git-svn-id: http://svn.tartarus.org/sgt/putty@10038 cda61777-01e9-0310-a592-d414129be87e

portfwd.c
ssh.c
ssh.h
x11fwd.c

index 00cff5ee1b73311119399c26ea0e626f9beebe5a..a93bb0660b3e9efd758e3997df29e8acf27f9150 100644 (file)
--- a/portfwd.c
+++ b/portfwd.c
@@ -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
diff --git a/ssh.c b/ssh.c
index f0a70c9acafca85de4054ff3f142326abf3a3b56..7fabb8394bff3d6c59c3452e7408109031a2c624 100644 (file)
--- a/ssh.c
+++ b/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;
diff --git a/ssh.h b/ssh.h
index 031fd974091fd1f4a67d07b550d10c34e1688bdd..5ddfcf3446007ac260084e77dbf9808524c58a31 100644 (file)
--- a/ssh.h
+++ b/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);
 
 /*
index 895d8a99d50028c2e028a97390b70cf26580c8ef..d848b218481744ab79159b20a73283470c53cdcc 100644 (file)
--- a/x11fwd.c
+++ b/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