]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Fix isatty() check for good.
authorGert Doering <gert@greenie.muc.de>
Wed, 9 Dec 2015 20:03:55 +0000 (21:03 +0100)
committerGert Doering <gert@greenie.muc.de>
Thu, 10 Dec 2015 16:03:19 +0000 (17:03 +0100)
commitdb55abd9e28546874edd78fa50df594a78e794b9
treee9450b24c98a731cc3a34c52e2ca7fbab45d0f60
parent0a9f866f78b5287e9996978898ccf213afd6b8d2
Fix isatty() check for good.

Commit 079e5b9c13 introduced a check to see if we --daemon'ized before
trying to ask for a password (which would then fail with a non-intuitive
error), breaking querying systemd under certain conditions.

Move check from get_user_pass_cr() to get_console_input() and make it
"full featured" by not only checking isatty() for stdin/stderr but also
trying to open /dev/tty in case we still have a controlling tty - which
is what getpass() does under the hood, so if either of this works, we're
fine.

Trac #618 and #630

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <1449691435-5928-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/10709
(cherry picked from commit 015fe7177181fb4944ddf33debcfcd20c62ba55a)
src/openvpn/console.c
src/openvpn/misc.c