]> git.ipfire.org Git - thirdparty/util-linux.git/commit
login: prevent undefined ioctl and tcsetattr calls
authorTobias Stoeckmann <tobias@stoeckmann.org>
Thu, 21 Sep 2023 18:25:55 +0000 (20:25 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Thu, 21 Sep 2023 20:36:54 +0000 (22:36 +0200)
commit3f13d198679437002df2dd0777a3bca879c0061c
tree1b34fd2bfa96c6bb493d3c8a3943a12e8182fdd3
parente361ef380fa2673e1de0f50d1f362b99e42cd0bb
login: prevent undefined ioctl and tcsetattr calls

Do not call tcsetattr if tcgetattr fails, because the content of
tt and ttt is undefined in that case.

Also do not just warn if ioctl fails, but also avoid calling it again
after tty has been re-opened.

I've solved this by setting struct variables to values which cannot be
valid at this point. If they do have these exact values, then the
calls will be prevented.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
login-utils/login.c