mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
Fix for `hostname-whitespace'; thanks to Justin Bradford.
[originally from svn r2080]
This commit is contained in:
parent
5bc8f34f58
commit
a24d9d3029
15
plink.c
15
plink.c
@ -458,6 +458,21 @@ int main(int argc, char **argv)
|
||||
*/
|
||||
cfg.host[strcspn(cfg.host, ":")] = '\0';
|
||||
|
||||
/*
|
||||
* Remove any remaining whitespace from the hostname.
|
||||
*/
|
||||
{
|
||||
int p1 = 0, p2 = 0;
|
||||
while (cfg.host[p2] != '\0') {
|
||||
if (cfg.host[p2] != ' ' && cfg.host[p2] != '\t') {
|
||||
cfg.host[p1] = cfg.host[p2];
|
||||
p1++;
|
||||
}
|
||||
p2++;
|
||||
}
|
||||
cfg.host[p1] = '\0';
|
||||
}
|
||||
|
||||
if (!*cfg.remote_cmd_ptr)
|
||||
flags |= FLAG_INTERACTIVE;
|
||||
|
||||
|
15
psftp.c
15
psftp.c
@ -1745,6 +1745,21 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
|
||||
*/
|
||||
cfg.host[strcspn(cfg.host, ":")] = '\0';
|
||||
|
||||
/*
|
||||
* Remove any remaining whitespace from the hostname.
|
||||
*/
|
||||
{
|
||||
int p1 = 0, p2 = 0;
|
||||
while (cfg.host[p2] != '\0') {
|
||||
if (cfg.host[p2] != ' ' && cfg.host[p2] != '\t') {
|
||||
cfg.host[p1] = cfg.host[p2];
|
||||
p1++;
|
||||
}
|
||||
p2++;
|
||||
}
|
||||
cfg.host[p1] = '\0';
|
||||
}
|
||||
|
||||
/* Set username */
|
||||
if (user != NULL && user[0] != '\0') {
|
||||
strncpy(cfg.username, user, sizeof(cfg.username) - 1);
|
||||
|
15
scp.c
15
scp.c
@ -512,6 +512,21 @@ static void do_cmd(char *host, char *user, char *cmd)
|
||||
*/
|
||||
cfg.host[strcspn(cfg.host, ":")] = '\0';
|
||||
|
||||
/*
|
||||
* Remove any remaining whitespace from the hostname.
|
||||
*/
|
||||
{
|
||||
int p1 = 0, p2 = 0;
|
||||
while (cfg.host[p2] != '\0') {
|
||||
if (cfg.host[p2] != ' ' && cfg.host[p2] != '\t') {
|
||||
cfg.host[p1] = cfg.host[p2];
|
||||
p1++;
|
||||
}
|
||||
p2++;
|
||||
}
|
||||
cfg.host[p1] = '\0';
|
||||
}
|
||||
|
||||
/* Set username */
|
||||
if (user != NULL && user[0] != '\0') {
|
||||
strncpy(cfg.username, user, sizeof(cfg.username) - 1);
|
||||
|
15
window.c
15
window.c
@ -430,6 +430,21 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
* Trim a colon suffix off the hostname if it's there.
|
||||
*/
|
||||
cfg.host[strcspn(cfg.host, ":")] = '\0';
|
||||
|
||||
/*
|
||||
* Remove any remaining whitespace from the hostname.
|
||||
*/
|
||||
{
|
||||
int p1 = 0, p2 = 0;
|
||||
while (cfg.host[p2] != '\0') {
|
||||
if (cfg.host[p2] != ' ' && cfg.host[p2] != '\t') {
|
||||
cfg.host[p1] = cfg.host[p2];
|
||||
p1++;
|
||||
}
|
||||
p2++;
|
||||
}
|
||||
cfg.host[p1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user