From a9d18d8993c3ae8eb474c2eea9f1d6dfcf750452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Sun, 26 Apr 2020 11:00:07 +0000 Subject: [PATCH] Setup a minimal sane TTY when asking for passphrases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- secret.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/secret.c b/secret.c index c4196ca..340eef1 100644 --- a/secret.c +++ b/secret.c @@ -129,6 +129,9 @@ s_input(unsigned char *buf, size_t size, const char *prompt) struct termios new = old; new.c_lflag &= ~(ECHO | ECHONL); + new.c_lflag |= ICANON; + new.c_iflag &= ~(INLCR | IGNCR); + new.c_iflag |= ICRNL; tcsetattr(fd, TCSAFLUSH, &new); ssize_t ret = read(fd, buf, size - 1);