Skip to contentSkip to conversation

fix regression: query password before becoming daemon

PATCH In review Steffan Karger 2 participants 2 messages Jul 9, 2015 – Jul 13, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix regression: query password before becoming daemon

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.

---
 src/openvpn/init.c    | 6 ++----
 src/openvpn/init.h    | 5 +++++
 src/openvpn/openvpn.c | 5 ++++-
 3 files changed, 11 insertions(+), 5 deletions(-)
src/openvpn/init.c +2 -4
index 13f5612..c24a646 100644
@@ -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;
src/openvpn/init.h +5 -0
index d1908ed..a819bd2 100644
@@ -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,
src/openvpn/openvpn.c +4 -1
index 00bd570..d05acde 100644
@@ -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)
 	    {
Signature · 1 line
2.1.4
#1 lore raw

Your patch has been applied to the master and release/2.3 branch.

commit 315f6fbc7f657a7f1127628bd714f468709d5185 (master) commit 7bde2e1b19e66af22c26c90e1187a4365c9087fc (release/2.3)

Author: Steffan Karger
Date:   Thu Jul 9 23:35:59 2015 +0200
     fix regression: query password before becoming daemon

     Signed-off-by: Steffan Karger <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/9901
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering