X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/fb09bf1c91b19418165baf649acdc9e21486c5b8..4017be6d5375063f59b63474490ac072e7f09b1a:/scp.c diff --git a/scp.c b/scp.c index 69ebac82..68eca580 100644 --- a/scp.c +++ b/scp.c @@ -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; } /* @@ -836,7 +844,7 @@ int main(int argc, char *argv[]) default_protocol = PROT_TELNET; - scp_flags = SCP_FLAG; + flags = 0; ssh_get_password = &get_password; init_winsock(); @@ -844,7 +852,7 @@ int main(int argc, char *argv[]) if (argv[i][0] != '-') break; if (strcmp(argv[i], "-v") == 0) - verbose = 1, scp_flags |= SCP_VERBOSE; + verbose = 1, flags |= FLAG_VERBOSE; else if (strcmp(argv[i], "-r") == 0) recursive = 1; else if (strcmp(argv[i], "-p") == 0)