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>
... | ... |
@@ -407,8 +407,8 @@ next_connection_entry (struct context *c) |
407 | 407 |
/* |
408 | 408 |
* Query for private key and auth-user-pass username/passwords |
409 | 409 |
*/ |
410 |
-static void |
|
411 |
-init_query_passwords (struct context *c) |
|
410 |
+void |
|
411 |
+init_query_passwords (const struct context *c) |
|
412 | 412 |
{ |
413 | 413 |
#ifdef ENABLE_CRYPTO |
414 | 414 |
/* Certificate password input */ |
... | ... |
@@ -502,8 +502,6 @@ context_init_1 (struct context *c) |
502 | 502 |
|
503 | 503 |
init_connection_list (c); |
504 | 504 |
|
505 |
- init_query_passwords (c); |
|
506 |
- |
|
507 | 505 |
#if defined(ENABLE_PKCS11) |
508 | 506 |
if (c->first_time) { |
509 | 507 |
int i; |
... | ... |
@@ -63,6 +63,11 @@ void init_instance_handle_signals (struct context *c, const struct env_set *env, |
63 | 63 |
|
64 | 64 |
void init_instance (struct context *c, const struct env_set *env, const unsigned int flags); |
65 | 65 |
|
66 |
+/** |
|
67 |
+ * Query for private key and auth-user-pass username/passwords. |
|
68 |
+ */ |
|
69 |
+void init_query_passwords (const struct context *c); |
|
70 |
+ |
|
66 | 71 |
void do_route (const struct options *options, |
67 | 72 |
struct route_list *route_list, |
68 | 73 |
struct route_ipv6_list *route_ipv6_list, |
... | ... |
@@ -228,7 +228,10 @@ openvpn_main (int argc, char *argv[]) |
228 | 228 |
/* test crypto? */ |
229 | 229 |
if (do_test_crypto (&c.options)) |
230 | 230 |
break; |
231 |
- |
|
231 |
+ |
|
232 |
+ /* Query passwords before becoming a daemon */ |
|
233 |
+ init_query_passwords (&c); |
|
234 |
+ |
|
232 | 235 |
/* become a daemon if --daemon */ |
233 | 236 |
if (c.first_time) |
234 | 237 |
{ |