X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/8e441086bf71318f2af96ef9c64a5f35c517c101..6fa2a729fee620a61088ae2a4f22db838a5ca89a:/psftp.c diff --git a/psftp.c b/psftp.c index 53b6616d..6a4ba563 100644 --- a/psftp.c +++ b/psftp.c @@ -2523,6 +2523,15 @@ int from_backend(void *frontend, int is_stderr, const char *data, int datalen) return 0; } +int from_backend_untrusted(void *frontend_handle, const char *data, int len) +{ + /* + * No "untrusted" output should get here (the way the code is + * currently, it's all diverted by FLAG_STDERR). + */ + assert(!"Unexpected call to from_backend_untrusted()"); + return 0; /* not reached */ +} int sftp_recvdata(char *buf, int len) { outptr = (unsigned char *) buf; @@ -2586,6 +2595,8 @@ static void usage(void) printf(" -4 -6 force use of IPv4 or IPv6\n"); printf(" -C enable compression\n"); printf(" -i key private key file for authentication\n"); + printf(" -noagent disable use of Pageant\n"); + printf(" -agent enable use of Pageant\n"); printf(" -batch disable all interactive prompts\n"); cleanup_exit(1); } @@ -2714,14 +2725,21 @@ static int psftp_connect(char *userhost, char *user, int portnumber) cfg.username[sizeof(cfg.username) - 1] = '\0'; } if (!cfg.username[0]) { - if (!console_get_line("login as: ", - cfg.username, sizeof(cfg.username), FALSE)) { + /* FIXME: leave this to ssh.c? */ + int ret; + prompts_t *p = new_prompts(NULL); + p->to_server = TRUE; + p->name = dupstr("SSH login name"); + add_prompt(p, dupstr("login as: "), TRUE, lenof(cfg.username)); + ret = get_userpass_input(p, NULL, 0); + assert(ret >= 0); + if (!ret) { + free_prompts(p); fprintf(stderr, "psftp: no username, aborting\n"); cleanup_exit(1); } else { - int len = strlen(cfg.username); - if (cfg.username[len - 1] == '\n') - cfg.username[len - 1] = '\0'; + memcpy(cfg.username, p->prompts[0]->result, lenof(cfg.username)); + free_prompts(p); } } @@ -2819,7 +2837,6 @@ int psftp_main(int argc, char *argv[]) #endif ; cmdline_tooltype = TOOLTYPE_FILETRANSFER; - ssh_get_line = &console_get_line; sk_init(); userhost = user = NULL;