]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
fix regression: query password before becoming daemon
authorSteffan Karger <steffan@karger.me>
Thu, 9 Jul 2015 21:35:59 +0000 (23:35 +0200)
committerGert Doering <gert@greenie.muc.de>
Mon, 13 Jul 2015 19:12:10 +0000 (21:12 +0200)
The init sequence was changed to daemonize before the crypto init to fix
issues on FreeBSD some commits ago.  This introduced a regression where
we would no longer query for passwords before daemonizing, as described
in trac #574 and #576.

This commit restores the correct order, and adds a bit of const
correctness since we're touching this now code anyway.

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

index 13f5612d1933b69e0f16159808b8f701965d97c1..c24a646f366c0ef90a205b04cc1a1c0c90620f23 100644 (file)
@@ -407,8 +407,8 @@ next_connection_entry (struct context *c)
 /*
  * Query for private key and auth-user-pass username/passwords
  */
-static void
-init_query_passwords (struct context *c)
+void
+init_query_passwords (const struct context *c)
 {
 #ifdef ENABLE_CRYPTO
   /* Certificate password input */
@@ -502,8 +502,6 @@ context_init_1 (struct context *c)
 
   init_connection_list (c);
 
-  init_query_passwords (c);
-
 #if defined(ENABLE_PKCS11)
   if (c->first_time) {
     int i;
index d1908ed128cf5c377d26f8bc23b7c4586236557e..a819bd2ce78f71dd207a6e74c779a50aa90ba7f1 100644 (file)
@@ -63,6 +63,11 @@ void init_instance_handle_signals (struct context *c, const struct env_set *env,
 
 void init_instance (struct context *c, const struct env_set *env, const unsigned int flags);
 
+/**
+ * Query for private key and auth-user-pass username/passwords.
+ */
+void init_query_passwords (const struct context *c);
+
 void do_route (const struct options *options,
               struct route_list *route_list,
               struct route_ipv6_list *route_ipv6_list,
index 00bd5703c36ec6ca7ddce4f4f4af942dd13ce6a1..d05acde3c1c9284821fff69f8bc81f5da7423266 100644 (file)
@@ -228,7 +228,10 @@ openvpn_main (int argc, char *argv[])
          /* test crypto? */
          if (do_test_crypto (&c.options))
            break;
-         
+
+         /* Query passwords before becoming a daemon */
+         init_query_passwords (&c);
+
          /* become a daemon if --daemon */
          if (c.first_time)
            {