jail: use sane termios settings for console pts
authorDaniel Golle <daniel@makrotopia.org>
Wed, 20 May 2020 13:57:21 +0000 (14:57 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 28 May 2020 10:42:34 +0000 (11:42 +0100)
The previously used expression (inpired by LXC) didn't actually make
a lot of sense. Replace it with something inspired by a more recent
version of LXC...

Reported-by: Oldřich Jedlička <oldium.pro@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
jail/console.c

index 75ce9c55cf66edb30504a34d3a308c13d586b1e5..d03edc54a25e8f53959f9282bdb269982f2af1ac 100644 (file)
@@ -38,11 +38,12 @@ static inline int setup_tios(int fd, struct termios *oldtios)
 
        newtios = *oldtios;
 
-       /* Remove the echo characters and signal reception, the echo
-        * will be done with master proxying */
-       newtios.c_iflag &= ~IGNBRK;
-       newtios.c_iflag &= BRKINT;
-       newtios.c_lflag &= ~(ECHO|ICANON|ISIG);
+       /* We use the same settings that ssh does. */
+       newtios.c_iflag |= IGNPAR;
+       newtios.c_iflag &= ~(ISTRIP | INLCR | IGNCR | ICRNL | IXON | IXANY | IXOFF);
+       newtios.c_lflag &= ~(TOSTOP | ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHONL);
+       newtios.c_oflag &= ~ONLCR;
+       newtios.c_oflag |= OPOST;
        newtios.c_cc[VMIN] = 1;
        newtios.c_cc[VTIME] = 0;