1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-21 22:28:37 -05:00

Add some fflushes to make it easier for piped programs to talk to

plink and pscp

[originally from svn r1078]
This commit is contained in:
Simon Tatham 2001-04-28 08:42:06 +00:00
parent 62e5e4c2e1
commit b7844a20af
3 changed files with 9 additions and 3 deletions

View File

@ -88,10 +88,14 @@ void verify_ssh_host_key(char *host, int port, char *keytype,
if (ret == 0) /* success - key matched OK */ if (ret == 0) /* success - key matched OK */
return; return;
if (ret == 2) /* key was different */ if (ret == 2) { /* key was different */
fprintf(stderr, wrongmsg, fingerprint); fprintf(stderr, wrongmsg, fingerprint);
if (ret == 1) /* key was absent */ fflush(stderr);
}
if (ret == 1) { /* key was absent */
fprintf(stderr, absentmsg, fingerprint); fprintf(stderr, absentmsg, fingerprint);
fflush(stderr);
}
hin = GetStdHandle(STD_INPUT_HANDLE); hin = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode(hin, &savemode); GetConsoleMode(hin, &savemode);

2
scp.c
View File

@ -134,12 +134,14 @@ void verify_ssh_host_key(char *host, int port, char *keytype,
return; return;
if (ret == 2) { /* key was different */ if (ret == 2) { /* key was different */
fprintf(stderr, wrongmsg, fingerprint); fprintf(stderr, wrongmsg, fingerprint);
fflush(stderr);
if (fgets(line, sizeof(line), stdin) && if (fgets(line, sizeof(line), stdin) &&
line[0] != '\0' && line[0] != '\n') { line[0] != '\0' && line[0] != '\n') {
if (line[0] == 'y' || line[0] == 'Y') if (line[0] == 'y' || line[0] == 'Y')
store_host_key(host, port, keytype, keystr); store_host_key(host, port, keytype, keystr);
} else { } else {
fprintf(stderr, abandoned); fprintf(stderr, abandoned);
fflush(stderr);
exit(0); exit(0);
} }
} }

2
ssh.c
View File

@ -17,7 +17,7 @@
#define logevent(s) { logevent(s); \ #define logevent(s) { logevent(s); \
if ((flags & FLAG_STDERR) && (flags & FLAG_VERBOSE)) \ if ((flags & FLAG_STDERR) && (flags & FLAG_VERBOSE)) \
fprintf(stderr, "%s\n", s); } { fprintf(stderr, "%s\n", s); fflush(stderr); } }
#define bombout(msg) ( ssh_state = SSH_STATE_CLOSED, \ #define bombout(msg) ( ssh_state = SSH_STATE_CLOSED, \
(s ? sk_close(s), s = NULL : 0), \ (s ? sk_close(s), s = NULL : 0), \