1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Use local username consistently in Unix Plink.

It tries to use the local username as the remote username if it has no
better ideas, but the presence of Default Settings would defeat this,
even if it had no username set. Reported by Jonathan Amery.
This commit is contained in:
Jacob Nevins 2015-01-05 23:41:43 +00:00
parent f3685eb948
commit 3a9ce5074d

View File

@ -119,8 +119,6 @@ char *platform_default_s(const char *name)
{
if (!strcmp(name, "TermType"))
return dupstr(getenv("TERM"));
if (!strcmp(name, "UserName"))
return get_username();
if (!strcmp(name, "SerialLine"))
return dupstr("/dev/ttyS0");
return NULL;
@ -882,6 +880,18 @@ int main(int argc, char **argv)
*/
cmdline_run_saved(conf);
/*
* If we have no better ideas for the remote username, use the local
* one, as 'ssh' does.
*/
if (conf_get_str(conf, CONF_username)[0] == '\0') {
char *user = get_username();
if (user) {
conf_set_str(conf, CONF_username, user);
sfree(user);
}
}
/*
* Apply subsystem status.
*/