projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Extra logging in SSH-2 port-forwarding. Most obviously, the opening of a
[u/mdw/putty]
/
unix
/
uxplink.c
diff --git
a/unix/uxplink.c
b/unix/uxplink.c
index
1691933
..
c9b5075
100644
(file)
--- a/
unix/uxplink.c
+++ b/
unix/uxplink.c
@@
-208,6
+208,7
@@
static void usage(void)
printf("Usage: plink [options] [user@]host [command]\n");
printf(" (\"host\" can also be a PuTTY saved session name)\n");
printf("Options:\n");
printf("Usage: plink [options] [user@]host [command]\n");
printf(" (\"host\" can also be a PuTTY saved session name)\n");
printf("Options:\n");
+ printf(" -V print version information\n");
printf(" -v show verbose messages\n");
printf(" -load sessname Load settings from saved session\n");
printf(" -ssh -telnet -rlogin -raw\n");
printf(" -v show verbose messages\n");
printf(" -load sessname Load settings from saved session\n");
printf(" -ssh -telnet -rlogin -raw\n");
@@
-234,6
+235,12
@@
static void usage(void)
exit(1);
}
exit(1);
}
+static void version(void)
+{
+ printf("plink: %s\n", ver);
+ exit(1);
+}
+
int main(int argc, char **argv)
{
int sending;
int main(int argc, char **argv)
{
int sending;
@@
-263,6
+270,7
@@
int main(int argc, char **argv)
* Process the command line.
*/
do_defaults(NULL, &cfg);
* Process the command line.
*/
do_defaults(NULL, &cfg);
+ loaded_session = FALSE;
default_protocol = cfg.protocol;
default_port = cfg.port;
errors = 0;
default_protocol = cfg.protocol;
default_port = cfg.port;
errors = 0;
@@
-301,6
+309,8
@@
int main(int argc, char **argv)
} else if (!strcmp(p, "-s")) {
/* Save status to write to cfg later. */
use_subsystem = 1;
} else if (!strcmp(p, "-s")) {
/* Save status to write to cfg later. */
use_subsystem = 1;
+ } else if (!strcmp(p, "-V")) {
+ version();
} else if (!strcmp(p, "-o")) {
if (argc <= 1) {
fprintf(stderr,
} else if (!strcmp(p, "-o")) {
if (argc <= 1) {
fprintf(stderr,
@@
-387,13
+397,15
@@
int main(int argc, char **argv)
*/
Config cfg2;
do_defaults(p, &cfg2);
*/
Config cfg2;
do_defaults(p, &cfg2);
- if (cfg2.host[0] == '\0') {
+ if (
loaded_session ||
cfg2.host[0] == '\0') {
/* No settings for this host; use defaults */
/* No settings for this host; use defaults */
+ /* (or session was already loaded with -load) */
strncpy(cfg.host, p, sizeof(cfg.host) - 1);
cfg.host[sizeof(cfg.host) - 1] = '\0';
cfg.port = default_port;
} else {
cfg = cfg2;
strncpy(cfg.host, p, sizeof(cfg.host) - 1);
cfg.host[sizeof(cfg.host) - 1] = '\0';
cfg.port = default_port;
} else {
cfg = cfg2;
+ /* Ick: patch up internal pointer after copy */
cfg.remote_cmd_ptr = cfg.remote_cmd;
}
} else {
cfg.remote_cmd_ptr = cfg.remote_cmd;
}
} else {
@@
-548,7
+560,7
@@
int main(int argc, char **argv)
int nodelay = cfg.tcp_nodelay && isatty(0);
error = back->init(NULL, &backhandle, &cfg, cfg.host, cfg.port,
int nodelay = cfg.tcp_nodelay && isatty(0);
error = back->init(NULL, &backhandle, &cfg, cfg.host, cfg.port,
- &realhost, nodelay);
+ &realhost, nodelay
, cfg.tcp_keepalives
);
if (error) {
fprintf(stderr, "Unable to open connection:\n%s\n", error);
return 1;
if (error) {
fprintf(stderr, "Unable to open connection:\n%s\n", error);
return 1;