aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelva Nair2015-11-26 21:20:53 -0500
committerGert Doering2015-11-29 14:24:35 +0100
commit9557196ffb3296f2a8e5aee4521702f1d0c2019b (patch)
tree8ad0ce1827f975988646dcdce79293569710bccc
parent2a15e74dd2669fd25bb0a77f4f52918713665ce6 (diff)
downloadopenvpn-9557196ffb3296f2a8e5aee4521702f1d0c2019b.zip
openvpn-9557196ffb3296f2a8e5aee4521702f1d0c2019b.tar.gz
Unbreak read username password from management
Commit 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. Signed-off-by: Selva Nair <selva.nair@gmail.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1448590853-26862-1-git-send-email-selva.nair@gmail.com> URL: http://article.gmane.org/gmane.network.openvpn.devel/10630 Signed-off-by: Gert Doering <gert@greenie.muc.de> (cherry picked from commit cdd69bb7f1c207fb5a9648f36440d7c6e2dcaa76)
-rw-r--r--src/openvpn/misc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index e4c83f1..c0d601e 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -1036,8 +1036,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);
@@ -1134,6 +1134,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?