]> git.ipfire.org Git - thirdparty/lxc.git/commit
make lxc-attach use a pty 825/head
authorChristian Brauner <christian.brauner@mailbox.org>
Mon, 15 Feb 2016 21:10:40 +0000 (22:10 +0100)
committerChristian Brauner <christian.brauner@mailbox.org>
Sun, 21 Feb 2016 17:42:33 +0000 (18:42 +0100)
commit5eacdc3dbd0e45abf3cc90cf0216a7f8ee560abf
treebb9d2944e953dadc3ea3f4a5e6da97f77ddde012
parent9395937a965ad3a777a3008c0615d9d5722e4460
make lxc-attach use a pty

So far lxc-attach did not use a pty when attaching to a container. This made it
vulnerable to tty input faking via TIOCSTI when switching to a different user.
This patch makes lxc-attach use a pty in most cases. The only current exemption
is when stdin, stdout, and stderr are not referring to a pty.

There are two ways how lxc-attach can receive a pty:
1. get a pty in the container
2. get a pty on the host
This patch makes 1. the default and only opts for 2. when 1. fails before
giving up. The rationale behind this is as follows: If we create a pty on the
host (2.) and pass the fds to the container the container may report "no tty"
when the "tty" command is used. This could be irritating for users when they
expect that lxc-attach now always tries to use a pty. Hence, option 1. is the
default.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
src/lxc/lxc_attach.c