Un-break --auth-user-pass on windows
PATCH 1/1 Un-break --auth-user-pass on windows
Commit b131c7b974d9d4d3f0 introduced a check to create a meaningful warning if we try to read a password after daemon()izing (by checking whether stdin or stderr is connected to a tty). For some reason this breaks on Windows builds if run under GUI control - but since Windows doesn't have this particular daemon() issue anyway, just #ifndef WIN32 the offending code.
--- src/openvpn/misc.c | 2 ++ 1 file changed, 2 insertions(+)
src/openvpn/misc.c +2 -0
@@ -1088,9 +1088,11 @@ get_user_pass_cr (struct user_pass *up,*/ else if (from_stdin) { +#ifndef WIN32 /* did we --daemon'ize before asking for passwords? */ if ( !isatty (0 ) && !isatty (2 ) ) {msg (M_FATAL ,"neither stdin nor stderr are a tty device, can't ask for %s password. If you used --daemon, you need to use --askpass to make passphrase-protected keys work, and you can not use --auth-nocache." , prefix ); } +#endif #ifdef ENABLE_CLIENT_CR if (auth_challenge && (flags &GET_USER_PASS_DYNAMIC_CHALLENGE ))
Signature · 1 line
2.3.6
Quoted 19 lines · Gert Doering
Commit
b131c7b974d9d4d3f0introduced a check to create a meaningful warning if we try to read a password after daemon()izing (by checking whether stdin or stderr is connected to a tty). For some reason this breaks on Windows builds if run under GUI control - but since Windows doesn't have this particulardaemon()issue anyway, just #ifndef WIN32 the offending code.Signed-off-by Gert Doering <[email protected]...>--- src/openvpn/misc.c | 2 ++ 1 file changed, 2 insertions(+)src/openvpn/misc.c +0
-0@@ -1088,9 +1088,11 @@ get_user_pass_cr (struct user_pass *up,*/
src/openvpn/misc.c get_user_pass_cr (struct user_pass *up, · line 1098
Quoted 10 lines
src/openvpn/misc.c +2
-0else if (from_stdin) { +#ifndef WIN32 /* did we --daemon'ize before asking for passwords? */ if ( !isatty (0 ) && !isatty (2 ) ) {msg (M_FATAL ,"neither stdin nor stderr are a tty device, can't ask for %s password. If you used --daemon, you need to use --askpass to make passphrase-protected keys work, and you can not use --auth-nocache." , prefix ); } +#endif #ifdef ENABLE_CLIENT_CR if (auth_challenge && (flags &GET_USER_PASS_DYNAMIC_CHALLENGE ))
ACK. Patch looks fine and mattock reported (on IRC) that this indeed fixes the issue on Windows.
-Steffan
Patch has been applied to the master and release/2.3 branch.
commit 0ffd744332f51878c4df430ab14aca3126bdfc8a (master) commit 0a1bb0f40f660efaabd7ee2a857791da6254337d (release/2.3)
Author: Gert Doering Date: Tue Aug 4 14:53:16 2015 +0200
Un-break --auth-user-pass on windows
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: Steffan Karger <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/10000--
kind regards,
Gert Doering