mirror of
https://github.com/angt/secret
synced 2024-11-16 19:48:05 +01:00
Setup a minimal sane TTY when asking for passphrases
Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
parent
961608c6d7
commit
a9d18d8993
1 changed files with 3 additions and 0 deletions
3
secret.c
3
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);
|
||||
|
|
Loading…
Reference in a new issue