summaryrefslogtreecommitdiff
path: root/src/openvpn/openvpn.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvpn/openvpn.c')
-rw-r--r--src/openvpn/openvpn.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c
index 2f327f3..32e326e 100644
--- a/src/openvpn/openvpn.c
+++ b/src/openvpn/openvpn.c
@@ -228,15 +228,28 @@ openvpn_main (int argc, char *argv[])
/* test crypto? */
if (do_test_crypto (&c.options))
break;
-
+
+ /* Query passwords before becoming a daemon if we don't use the
+ * management interface to get them. */
+#ifdef ENABLE_MANAGEMENT
+ if (!(c.options.management_flags & MF_QUERY_PASSWORDS))
+#endif
+ init_query_passwords (&c);
+
/* become a daemon if --daemon */
if (c.first_time)
- c.did_we_daemonize = possibly_become_daemon (&c.options);
+ {
+ c.did_we_daemonize = possibly_become_daemon (&c.options);
+ write_pid (c.options.writepid);
+ }
#ifdef ENABLE_MANAGEMENT
/* open management subsystem */
if (!open_management (&c))
break;
+ /* query for passwords through management interface, if needed */
+ if (c.options.management_flags & MF_QUERY_PASSWORDS)
+ init_query_passwords (&c);
#endif
/* set certain options as environmental variables */