From d147f764eaca36b7a97180718793124d89e6fa9e Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 27 Feb 2019 20:31:48 +0000 Subject: [PATCH] Plink: fix mishandling of launchable Default Settings. Plink's hostname argument can refer to a saved session instead of a hostname. We test this by trying to load it as a session, and seeing if the resulting Conf is launchable. But if Default Settings itself is launchable (e.g. if it has the protocol set to Serial) then that can happen even if there is no saved session with that name - in which case we'll _never_ fall back to treating the argument as a host name. Fixed by also checking the new success flag returned from do_defaults. --- cmdline.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmdline.c b/cmdline.c index f71a7763..f4dea071 100644 --- a/cmdline.c +++ b/cmdline.c @@ -332,7 +332,8 @@ int cmdline_process_param(const char *p, char *value, * hostname argument and an argument naming a * saved session. Here we attempt to load a * session with the specified name, and if that - * succeeds, we overwrite the entire Conf with it. + * session exists and is launchable, we overwrite + * the entire Conf with it. * * We skip this check if a -load option has * already happened, so that @@ -350,8 +351,8 @@ int cmdline_process_param(const char *p, char *value, * -load completely.) */ Conf *conf2 = conf_new(); - do_defaults(hostname_after_user, conf2); - if (conf_launchable(conf2)) { + if (do_defaults(hostname_after_user, conf2) && + conf_launchable(conf2)) { conf_copy_into(conf, conf2); loaded_session = true; /* And override the username if one was given. */