1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

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.
This commit is contained in:
Simon Tatham 2019-02-27 20:31:48 +00:00
parent 55123b105d
commit d147f764ea

View File

@ -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. */