]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
If a module is dlopened twice, then deinitialize the second load.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 13 Aug 2011 08:02:15 +0000 (10:02 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 13 Aug 2011 08:02:50 +0000 (10:02 +0200)
NEWS
lib/pkcs11.c

diff --git a/NEWS b/NEWS
index f1581f36420c1f1f428c98648fbe165a3bb6a1e4..e4a2fbea88bcecfd9a4cf6dcfee9a2bbb9bf06e2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ See the end for copying conditions.
 
 * Version 3.0.1 (unreleased)
 
+** libgnutls: Do not allow second instances of PKCS #11
+modules.
+
 ** libgnutls: fixed alignment issue in AES-NI code.
 
 ** libgnutls: The config file at gnutls_pkcs11_init()
index f8be3344c607613d387569120526330069b9df5e..9db09c50f34e76d2b471aec2c570eb0b4e6a69fe 100644 (file)
@@ -196,7 +196,7 @@ pkcs11_add_module (const char *name, struct ck_function_list *module)
       if (memcmp(&info, &providers[i].info, sizeof(info)) == 0)
         {
           _gnutls_debug_log("%s is already loaded.\n", name);
-          return 0;
+          return GNUTLS_E_INT_RET_0;
         }
     }
 
@@ -281,6 +281,7 @@ gnutls_pkcs11_add_provider (const char *name, const char *params)
     }
   else
     {
+      if (ret == GNUTLS_E_INT_RET_0) ret = 0;
       p11_kit_finalize_module (module);
       gnutls_assert ();
     }
@@ -504,7 +505,7 @@ initialize_automatic_p11_kit (void)
     {
       name = p11_kit_registered_module_to_name (modules[i]);
       ret = pkcs11_add_module (name, modules[i]);
-      if (ret != 0)
+      if (ret != 0 && ret != GNUTLS_E_INT_RET_0)
         {
           gnutls_assert ();
           _gnutls_debug_log ("Cannot add registered module: %s\n", name);