]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Re-read auth-user-pass file on (re)connect if required
authorSteffan Karger <steffan@karger.me>
Sat, 23 May 2015 13:02:25 +0000 (15:02 +0200)
committerGert Doering <gert@greenie.muc.de>
Sat, 23 May 2015 19:20:32 +0000 (21:20 +0200)
Fixes trac #225 ('--auth-user-pass FILE' and '--auth-nocache' problem).

This patch is based on the changes suggested by ye_olde_iron in the trac
ticket.  Also added a note to the manpage to inform people to use
absolute paths when combining --auth-user-pass file and --auth-nocache.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1432386145-15045-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9717
Signed-off-by: Gert Doering <gert@greenie.muc.de>
doc/openvpn.8
src/openvpn/init.c
src/openvpn/ssl.c
src/openvpn/ssl_common.h

index ef87bb7223f545a02d32f3bff4d3c069e6828a15..67e6ddd59b983d729639e0722166756ac6561a83 100644 (file)
@@ -4786,6 +4786,9 @@ when OpenVPN needs a username/password, it will prompt for input
 from stdin, which may be multiple times during the duration of an
 OpenVPN session.
 
+When using \-\-auth\-nocache in combination with a user/password file
+and \-\-chroot or \-\-daemon, make sure to use an absolute path.
+
 This directive does not affect the
 .B \-\-http\-proxy
 username/password.  It is always cached.
index 3434ce07d9a08893cd896d28c4a0c7869e13e30b..d093f463d3d6a83810eef22962846f1674582406 100644 (file)
@@ -2252,6 +2252,7 @@ do_init_crypto_tls (struct context *c, const unsigned int flags)
   to.tmp_dir = options->tmp_dir;
   if (options->ccd_exclusive)
     to.client_config_dir_exclusive = options->client_config_dir;
+  to.auth_user_pass_file = options->auth_user_pass_file;
 #endif
 
 #ifdef ENABLE_X509_TRACK
index dce6c3042e858bfb52f6b865394de2859ff1202a..ebb2f0db93ea1646efb3d3afb07cb167e6f3409d 100644 (file)
@@ -1920,9 +1920,9 @@ key_method_2_write (struct buffer *buf, struct tls_session *session)
   if (auth_user_pass_enabled)
     {
 #ifdef ENABLE_CLIENT_CR
-      auth_user_pass_setup (NULL, session->opt->sci);
+      auth_user_pass_setup (session->opt->auth_user_pass_file, session->opt->sci);
 #else
-      auth_user_pass_setup (NULL, NULL);
+      auth_user_pass_setup (session->opt->auth_user_pass_file, NULL);
 #endif
       if (!write_string (buf, auth_user_pass.username, -1))
        goto error;
index bb1c1c281f679f472224eed17229d4ff1751dafc..95cd2f7d93d1df01efb1ae5354676337fbd3bb8e 100644 (file)
@@ -277,6 +277,7 @@ struct tls_options
   const char *auth_user_pass_verify_script;
   bool auth_user_pass_verify_script_via_file;
   const char *tmp_dir;
+  const char *auth_user_pass_file;
 
   /* use the client-config-dir as a positive authenticator */
   const char *client_config_dir_exclusive;