]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Command-line options to log sessions.
authorSimon Tatham <anakin@pobox.com>
Thu, 24 Sep 2015 16:30:04 +0000 (17:30 +0100)
committerSimon Tatham <anakin@pobox.com>
Thu, 24 Sep 2015 16:30:04 +0000 (17:30 +0100)
Log files, especially SSH packet logs, are often things you want to
generate in unusual circumstances, so it's good to have lots of ways
to ask for them. Particularly, it's especially painful to have to set
up a custom saved session to get diagnostics out of the command-line
tools.

I've added options '-sessionlog', '-sshlog' and '-sshrawlog', each of
which takes a filename argument. I think the fourth option (session
output but filtered down to the printable subset) is not really a
_debugging_ log in the same sense, so it's not as critical to have an
option for it.

cmdline.c

index ee1d31e7580fa30826cda3320eb3881fbbbf3215..fbf1e5c9e69710fce26e19320f076a314d921e27 100644 (file)
--- a/cmdline.c
+++ b/cmdline.c
@@ -574,6 +574,23 @@ int cmdline_process_param(const char *p, char *value,
            nextitem += length + skip;
        }
     }
+
+    if (!strcmp(p, "-sessionlog") ||
+        !strcmp(p, "-sshlog") ||
+        !strcmp(p, "-sshrawlog")) {
+       Filename *fn;
+       RETURN(2);
+       UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
+       SAVEABLE(0);
+       fn = filename_from_str(value);
+       conf_set_filename(conf, CONF_logfilename, fn);
+       conf_set_int(conf, CONF_logtype,
+                     !strcmp(p, "-sessionlog") ? LGTYP_DEBUG :
+                     !strcmp(p, "-sshlog") ? LGTYP_PACKETS :
+                     /* !strcmp(p, "-sshrawlog") ? */ LGTYP_SSHRAW);
+        filename_free(fn);
+    }
+
     return ret;                               /* unrecognised */
 }