1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

PSCP: After a password supplied with `-pw' fails to authenticate,

we should _not_ fall back to console input for a second attempt,
because this hangs batch files.

[originally from svn r513]
This commit is contained in:
Simon Tatham
2000-07-21 09:17:05 +00:00
parent 7a01fd48b6
commit 9546cf7393
3 changed files with 49 additions and 12 deletions

18
scp.c
View File

@ -77,16 +77,22 @@ static void bump(char *fmt, ...)
exit(1);
}
static void get_password(const char *prompt, char *str, int maxlen)
static int get_password(const char *prompt, char *str, int maxlen)
{
HANDLE hin, hout;
DWORD savemode, i;
if (password) {
strncpy(str, password, maxlen);
str[maxlen-1] = '\0';
password = NULL;
return;
static int tried_once = 0;
if (tried_once) {
return 0;
} else {
strncpy(str, password, maxlen);
str[maxlen-1] = '\0';
tried_once = 1;
return 1;
}
}
hin = GetStdHandle(STD_INPUT_HANDLE);
@ -107,6 +113,8 @@ static void get_password(const char *prompt, char *str, int maxlen)
str[i] = '\0';
WriteFile(hout, "\r\n", 2, &i, NULL);
return 1;
}
/*