mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
7eb7d5e2e9
(TL;DR: to suppress redundant 'Press Return to begin session' prompts in between hops of a jump-host configuration, in Plink.) This new query method directly asks the Seat the question: is the same stream of input used to provide responses to interactive login prompts, and the session input provided after login concludes? It's used to suppress the last-ditch anti-spoofing defence in Plink of interactively asking 'Access granted. Press Return to begin session', on the basis that any such spoofing attack works by confusing the user about what's a legit login prompt before the session begins and what's sent by the server after the main session begins - so if those two things take input from different places, the user can't be confused. This doesn't change the existing behaviour of Plink, which was already suppressing the antispoof prompt in cases where its standard input was redirected from something other than a terminal. But previously it was doing it within the can_set_trust_status() seat query, and I've now moved it out into a separate query function. The reason why these need to be separate is for SshProxy, which needs to give an unusual combination of answers when run inside Plink. For can_set_trust_status(), it needs to return whatever the parent Seat returns, so that all the login prompts for a string of proxy connections in session will be antispoofed the same way. But you only want that final 'Access granted' prompt to happen _once_, after all the proxy connection setup phases are done, because up until then you're still in the safe hands of PuTTY itself presenting an unbroken sequence of legit login prompts (even if they come from a succession of different servers). Hence, SshProxy unconditionally returns 'no' to the query of whether it has a single mixed input stream, because indeed, it never does - for purposes of session input it behaves like an always-redirected Plink, no matter what kind of real Seat it ends up sending its pre-session login prompts to.
51 lines
2.7 KiB
C
51 lines
2.7 KiB
C
/*
|
|
* Stub methods usable by Seat implementations.
|
|
*/
|
|
|
|
#include "putty.h"
|
|
|
|
size_t nullseat_output(
|
|
Seat *seat, SeatOutputType type, const void *data, size_t len) {return 0;}
|
|
bool nullseat_eof(Seat *seat) { return true; }
|
|
void nullseat_sent(Seat *seat, size_t bufsize) {}
|
|
size_t nullseat_banner(Seat *seat, const void *data, size_t len) {return 0;}
|
|
size_t nullseat_banner_to_stderr(Seat *seat, const void *data, size_t len)
|
|
{ return seat_output(seat, SEAT_OUTPUT_STDERR, data, len); }
|
|
int nullseat_get_userpass_input(Seat *seat, prompts_t *p) { return 0; }
|
|
void nullseat_notify_session_started(Seat *seat) {}
|
|
void nullseat_notify_remote_exit(Seat *seat) {}
|
|
void nullseat_notify_remote_disconnect(Seat *seat) {}
|
|
void nullseat_connection_fatal(Seat *seat, const char *message) {}
|
|
void nullseat_update_specials_menu(Seat *seat) {}
|
|
char *nullseat_get_ttymode(Seat *seat, const char *mode) { return NULL; }
|
|
void nullseat_set_busy_status(Seat *seat, BusyStatus status) {}
|
|
int nullseat_confirm_ssh_host_key(
|
|
Seat *seat, const char *host, int port, const char *keytype,
|
|
char *keystr, const char *keydisp, char **key_fingerprints, bool mismatch,
|
|
void (*callback)(void *ctx, int result), void *ctx) { return 0; }
|
|
int nullseat_confirm_weak_crypto_primitive(
|
|
Seat *seat, const char *algtype, const char *algname,
|
|
void (*callback)(void *ctx, int result), void *ctx) { return 0; }
|
|
int nullseat_confirm_weak_cached_hostkey(
|
|
Seat *seat, const char *algname, const char *betteralgs,
|
|
void (*callback)(void *ctx, int result), void *ctx) { return 0; }
|
|
bool nullseat_is_never_utf8(Seat *seat) { return false; }
|
|
bool nullseat_is_always_utf8(Seat *seat) { return true; }
|
|
void nullseat_echoedit_update(Seat *seat, bool echoing, bool editing) {}
|
|
const char *nullseat_get_x_display(Seat *seat) { return NULL; }
|
|
bool nullseat_get_windowid(Seat *seat, long *id_out) { return false; }
|
|
bool nullseat_get_window_pixel_size(
|
|
Seat *seat, int *width, int *height) { return false; }
|
|
StripCtrlChars *nullseat_stripctrl_new(
|
|
Seat *seat, BinarySink *bs_out, SeatInteractionContext sic) {return NULL;}
|
|
void nullseat_set_trust_status(Seat *seat, bool trusted) {}
|
|
bool nullseat_can_set_trust_status_yes(Seat *seat) { return true; }
|
|
bool nullseat_can_set_trust_status_no(Seat *seat) { return false; }
|
|
bool nullseat_has_mixed_input_stream_yes(Seat *seat) { return true; }
|
|
bool nullseat_has_mixed_input_stream_no(Seat *seat) { return false; }
|
|
bool nullseat_verbose_no(Seat *seat) { return false; }
|
|
bool nullseat_verbose_yes(Seat *seat) { return true; }
|
|
bool nullseat_interactive_no(Seat *seat) { return false; }
|
|
bool nullseat_interactive_yes(Seat *seat) { return true; }
|
|
bool nullseat_get_cursor_position(Seat *seat, int *x, int *y) { return false; }
|