From 4ed811fdb44bdfcd8200319bbdbcbfdb499afa79 Mon Sep 17 00:00:00 2001 From: quamrulmina Date: Wed, 9 Mar 2016 14:54:51 -0600 Subject: [PATCH] sshd session will not echo password in an app/program run within sshd session Fixes problem #143 ; Turning off echo does not work. Now "net use" to mount a drive or sftp, scp, run within a ssh session will not echo password. --- channels.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/channels.c b/channels.c index e7d2a51..99d6f79 100644 --- a/channels.c +++ b/channels.c @@ -2511,7 +2511,11 @@ channel_input_data(int type, u_int32_t seq, void *ctxt) } } else { - buffer_append(&c->input, data, data_len); + // avoid echoing if echo is tuned off by the current running application + DWORD dwGlobalConsoleMode; + GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &dwGlobalConsoleMode); + if (dwGlobalConsoleMode & (ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT)) + buffer_append(&c->input, data, data_len); charinline += data_len; // one more char on the line }