Attention is currently required from: Arne Schwabe, Răzvan Cojocaru.

Hello Arne Schwabe, Răzvan Cojocaru,

I'd like you to reexamine a change. Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2388?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Code-Review+2 by Răzvan Cojocaru

The change is no longer submittable: Code-Review and checks~ChecksSubmitRule 
are unsatisfied now.


Change subject: pkcs11: Initialize pkcs11-helper early
......................................................................

pkcs11: Initialize pkcs11-helper early

Initializing before open_management() is required for
management interface directives such as pkcs11-id-count to
not error out if used during the first management-hold,
for example.

Github: fixes OpenVPN/openvpn#1166

Change-Id: Ibd33f20108d3ca8ddc17f145502d21d2f6e6d91a
Signed-off-by: Selva Nair <[email protected]>
---
M src/openvpn/init.c
M src/openvpn/init.h
M src/openvpn/openvpn.c
3 files changed, 23 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/88/2388/2

diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 49fcaf6..d26d759 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -747,20 +747,6 @@

     do_link_socket_addr_new(c);

-#if defined(ENABLE_PKCS11)
-    if (c->first_time)
-    {
-        int i;
-        pkcs11_initialize(true, c->options.pkcs11_pin_cache_period);
-        for (i = 0; i < MAX_PARMS && c->options.pkcs11_providers[i] != NULL; 
i++)
-        {
-            pkcs11_addProvider(
-                c->options.pkcs11_providers[i], 
c->options.pkcs11_protected_authentication[i],
-                c->options.pkcs11_private_mode[i], 
c->options.pkcs11_cert_private[i]);
-        }
-    }
-#endif
-
 #if 0 /* test get_user_pass with GET_USER_PASS_NEED_OK flag */
     {
         /*
@@ -786,6 +772,26 @@
 }

 void
+init_pkcs11(const struct context *c)
+{
+#if defined(ENABLE_PKCS11)
+    if (c->first_time)
+    {
+        if (!pkcs11_initialize(true, c->options.pkcs11_pin_cache_period))
+        {
+            msg(M_FATAL, "ERROR: pkcs11-helper initialization failed.");
+        }
+        for (int i = 0; i < MAX_PARMS && c->options.pkcs11_providers[i] != 
NULL; i++)
+        {
+            pkcs11_addProvider(
+                c->options.pkcs11_providers[i], 
c->options.pkcs11_protected_authentication[i],
+                c->options.pkcs11_private_mode[i], 
c->options.pkcs11_cert_private[i]);
+        }
+    }
+#endif
+}
+
+void
 context_gc_free(struct context *c)
 {
     gc_free(&c->c2.gc);
diff --git a/src/openvpn/init.h b/src/openvpn/init.h
index d028280..b3ee75b 100644
--- a/src/openvpn/init.h
+++ b/src/openvpn/init.h
@@ -34,6 +34,7 @@
 void context_clear_2(struct context *c);

 void context_init_1(struct context *c);
+void init_pkcs11(const struct context *c);

 void context_clear_all_except_first_time(struct context *c);

diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c
index d9a7c85..50be82c 100644
--- a/src/openvpn/openvpn.c
+++ b/src/openvpn/openvpn.c
@@ -280,6 +280,8 @@
                 write_pid_file(c.options.writepid, c.options.chroot_dir);
             }

+            init_pkcs11(&c);
+
 #ifdef ENABLE_MANAGEMENT
             /* open management subsystem */
             if (!open_management(&c))

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2388?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibd33f20108d3ca8ddc17f145502d21d2f6e6d91a
Gerrit-Change-Number: 2388
Gerrit-PatchSet: 2
Gerrit-Owner: Selva Nair <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Răzvan Cojocaru <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Răzvan Cojocaru <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to