Unbreak read username password from management
PATCH 1/1 Unbreak read username password from management
Commit 6e9373c846.. introduced a bug by which auth-user-pass input falls back to read-from-stdin after successfully reading from management.
--- src/openvpn/misc.c | 3 +++ 1 file changed, 3 insertions(+)
src/openvpn/misc.c +3 -0
@@ -1020,6 +1020,9 @@ get_user_pass_cr (struct user_pass *up, {const char *sc =NULL ; + username_from_stdin = false; + password_from_stdin = false; +if (flags &GET_USER_PASS_PREVIOUS_CREDS_FAILED )management_auth_failure (management, prefix,"previous auth credentials failed" );
Signature · 1 line
1.7.10.4
Hi,
Quoted 3 lines · Selva Nair
Commit
6e9373c846.. introduced a bug by which auth-user-pass input falls back to read-from-stdin after successfully reading from management.
Mmmmh. I was all willing to merge the other one - but this one looks like a workable alternative as well, just tell the subsequent code "we're done, no need to query anymore".
Any other variants that could trigger this?
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi,
Quoted 6 lines · Gert Doering
Quoted 3 lines · Selva Nair
Commit
6e9373c846.. introduced a bug by which auth-user-pass input falls back to read-from-stdin after successfully reading from management.Mmmmh. I was all willing to merge the other one -
That one fixed my use case but will break others.. Sorry, I should have tested more before posting..
Quoted 4 lines
but this one looks
like a workable alternative as well, just tell the subsequent code "we're done, no need to query anymore".
Yeah, it ain't pretty. Who uses three bools to handle four cases? For cleaner code I would kill the bools and get a flag. I hate bools :-) But, that would entail extensive testing --- I guess, leave it for some other time when more changes are made in the context.
Quoted 2 lines
Any other variants that could trigger this?
Tested these cases: user from file, pass from stdin; both from file, both from stdin and both from management with retries triggered by failed auth.
But now that you ask, looked again and I suspect the NEED_OK case also may trigger the fall back to stdin. That's used when a token is inserted right? Will try to trigger that and see.
All this to save a feature of dubious utility[*]?
Selva
[*] Well, windows users with a 16 wchar username and two embedded spaces but 4 char password of "test" may want to save typing username again and again... Sorry, I'm irked by a patch that broke my vpn :-)
PATCH 1/1 Unbreak read username password from management
In reply to Gert DoeringCommit 6e9373c846.. introduced a bug by which auth-user-pass or need-ok input falls back to read-from-stdin after successfully reading from management or console. Fix by treating stdin as the last option for input.
---
Changes: Delay the setting of "xx_from_stdin" flags
Tested: user/pass from management, file, stdin and a simulated NEED_OK
to stdin and management.
src/openvpn/misc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
src/openvpn/misc.c +7 -2
@@ -1004,8 +1004,8 @@ get_user_pass_cr (struct user_pass *up,if (!up->defined) {bool from_authfile = (auth_file && !streq (auth_file,"stdin" )); -bool username_from_stdin = !from_authfile; -bool password_from_stdin = !from_authfile; +bool username_from_stdin = false; +bool password_from_stdin = false;if (flags &GET_USER_PASS_PREVIOUS_CREDS_FAILED )msg (M_WARN ,"Note: previous '%s' credentials failed" , prefix);
@@ -1102,6 +1102,11 @@ get_user_pass_cr (struct user_pass *up,if (!(flags &GET_USER_PASS_PASSWORD_ONLY ) &&strlen (up->username) ==0 )msg (M_FATAL ,"ERROR: username from %s authfile '%s' is empty" , prefix, auth_file); } +else + { + username_from_stdin = true; + password_from_stdin = true; + }/* * Get username/password from standard input?
Signature · 1 line
1.7.10.4
ACK. This looks reasonable, and I've tested the use cases I can easily test here ("all from stdin", "username from file, pass from stdin", "both from file"). Sorry for causing you pain in your VPN setups - and thanks for taking care of this.
Your patch has been applied to the master and release/2.3 branch.
commit cdd69bb7f1c207fb5a9648f36440d7c6e2dcaa76 (master) commit 9557196ffb3296f2a8e5aee4521702f1d0c2019b (release/2.3)
Author: Selva Nair Date: Thu Nov 26 21:20:53 2015 -0500
Unbreak read username password from management
Signed-off-by: Selva Nair <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/10630
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering