Skip to content

Commit 4ed811f

Browse files
committed
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.
1 parent 91adb0c commit 4ed811f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

channels.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2511,7 +2511,11 @@ channel_input_data(int type, u_int32_t seq, void *ctxt)
25112511
}
25122512
}
25132513
else {
2514-
buffer_append(&c->input, data, data_len);
2514+
// avoid echoing if echo is tuned off by the current running application
2515+
DWORD dwGlobalConsoleMode;
2516+
GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &dwGlobalConsoleMode);
2517+
if (dwGlobalConsoleMode & (ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT))
2518+
buffer_append(&c->input, data, data_len);
25152519
charinline += data_len; // one more char on the line
25162520
}
25172521

0 commit comments

Comments
 (0)