diff options
author | Brent Cook <bcook@openbsd.org> | 2015-07-16 10:23:57 -0500 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2015-07-16 10:27:57 -0500 |
commit | ddeb740426716de91135def46d8408da9d730586 (patch) | |
tree | 70056a2b668e06851ff6b8172796956ff019e2e7 | |
parent | c1a162d83b12babd697586ede45815f890d7a40e (diff) | |
download | portable-ddeb740426716de91135def46d8408da9d730586.tar.gz portable-ddeb740426716de91135def46d8408da9d730586.tar.bz2 portable-ddeb740426716de91135def46d8408da9d730586.zip |
win32 openssl CLI: preserve original echo state
Mirror the patch to ui_openssl.c, also fix the broken conditional that
made it not actually turn off echo in the first place.
ok guenther@
-rw-r--r-- | crypto/compat/ui_openssl_win.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/crypto/compat/ui_openssl_win.c b/crypto/compat/ui_openssl_win.c index ecf7376..6597c6a 100644 --- a/crypto/compat/ui_openssl_win.c +++ b/crypto/compat/ui_openssl_win.c | |||
@@ -133,6 +133,7 @@ | |||
133 | /* Define globals. They are protected by a lock */ | 133 | /* Define globals. They are protected by a lock */ |
134 | static void (*savsig[NX509_SIG])(int ); | 134 | static void (*savsig[NX509_SIG])(int ); |
135 | 135 | ||
136 | DWORD console_mode; | ||
136 | static FILE *tty_in, *tty_out; | 137 | static FILE *tty_in, *tty_out; |
137 | static int is_a_tty; | 138 | static int is_a_tty; |
138 | 139 | ||
@@ -300,28 +301,27 @@ open_console(UI *ui) | |||
300 | tty_in = stdin; | 301 | tty_in = stdin; |
301 | tty_out = stderr; | 302 | tty_out = stderr; |
302 | 303 | ||
303 | return 1; | 304 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); |
305 | if (handle != INVALID_HANDLE_VALUE) | ||
306 | return GetConsoleMode(handle, &console_mode); | ||
307 | return 0; | ||
304 | } | 308 | } |
305 | 309 | ||
306 | static int | 310 | static int |
307 | noecho_console(UI *ui) | 311 | noecho_console(UI *ui) |
308 | { | 312 | { |
309 | DWORD mode = 0; | ||
310 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); | 313 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); |
311 | if (handle != INVALID_HANDLE_VALUE && handle != handle) { | 314 | if (handle != INVALID_HANDLE_VALUE) |
312 | return GetConsoleMode(handle, &mode) && SetConsoleMode(handle, mode & (~ENABLE_ECHO_INPUT)); | 315 | return SetConsoleMode(handle, console_mode & ~ENABLE_ECHO_INPUT); |
313 | } | ||
314 | return 0; | 316 | return 0; |
315 | } | 317 | } |
316 | 318 | ||
317 | static int | 319 | static int |
318 | echo_console(UI *ui) | 320 | echo_console(UI *ui) |
319 | { | 321 | { |
320 | DWORD mode = 0; | ||
321 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); | 322 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); |
322 | if (handle != INVALID_HANDLE_VALUE && handle != handle) { | 323 | if (handle != INVALID_HANDLE_VALUE) |
323 | return GetConsoleMode(handle, &mode) && SetConsoleMode(handle, mode | ENABLE_ECHO_INPUT); | 324 | return SetConsoleMode(handle, console_mode); |
324 | } | ||
325 | return 0; | 325 | return 0; |
326 | } | 326 | } |
327 | 327 | ||