UI console: Restore tty settings, do not force ECHO after prompt
authorRichard Levitte <levitte@openssl.org>
Wed, 2 May 2018 12:28:53 +0000 (14:28 +0200)
committerRichard Levitte <levitte@openssl.org>
Mon, 14 May 2018 09:01:45 +0000 (11:01 +0200)
The Console UI method always set echo on after prompting without
echo.  However, echo might not have been on originally, so just
restore the original TTY settings.

Fixes #2373

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6158)

crypto/ui/ui_openssl.c

index 8a43590319fa9809f3a41eb873e16cde351b1f5e..5dcb91a065eb3b5b1a168b99587e8438465b78b9 100644 (file)
@@ -567,17 +567,13 @@ static int echo_console(UI *ui)
 {
 #if defined(TTY_set) && !defined(OPENSSL_SYS_VMS)
     memcpy(&(tty_new), &(tty_orig), sizeof(tty_orig));
-    tty_new.TTY_FLAGS |= ECHO;
-#endif
-
-#if defined(TTY_set) && !defined(OPENSSL_SYS_VMS)
     if (is_a_tty && (TTY_set(fileno(tty_in), &tty_new) == -1))
         return 0;
 #endif
 #ifdef OPENSSL_SYS_VMS
     if (is_a_tty) {
         tty_new[0] = tty_orig[0];
-        tty_new[1] = tty_orig[1] & ~TT$M_NOECHO;
+        tty_new[1] = tty_orig[1];
         tty_new[2] = tty_orig[2];
         status = sys$qiow(0, channel, IO$_SETMODE, &iosb, 0, 0, tty_new, 12,
                           0, 0, 0, 0);