]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Unbreak read username password from management
authorSelva Nair <selva.nair@gmail.com>
Fri, 27 Nov 2015 02:20:53 +0000 (21:20 -0500)
committerGert Doering <gert@greenie.muc.de>
Sun, 29 Nov 2015 13:10:02 +0000 (14:10 +0100)
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>
src/openvpn/misc.c

index 14bb0e6b642caca223c225660750a5125ad858b7..31815cb54a08ff6a7dad826a674f8bd46b48d6d2 100644 (file)
@@ -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?