From cfae7e38b7c8b50eb3ff7226fe855163581d5b74 Mon Sep 17 00:00:00 2001
Message-Id: <cfae7e38b7c8b50eb3ff7226fe855163581d5b74.1375955382.git.minovotn@redhat.com>
In-Reply-To: <7d8ebc793c9bc4b5058ec1189139e7912e209e19.1375955382.git.minovotn@redhat.com>
References: <7d8ebc793c9bc4b5058ec1189139e7912e209e19.1375955382.git.minovotn@redhat.com>
From: Alon Levy <alevy@redhat.com>
Date: Thu, 1 Aug 2013 11:53:32 +0200
Subject: [PATCH 13/35] libcacard: remove default libcoolkey loading
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

RH-Author: Alon Levy <alevy@redhat.com>
Message-id: <1375358029-12968-14-git-send-email-alevy@redhat.com>
Patchwork-id: 52903
O-Subject: [RHEL-6.5 RHEL-6.4.z qemu-kvm v6 13/30] libcacard: remove default libcoolkey loading
Bugzilla: 917860
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
RH-Acked-by: Marc-André Lureau <mlureau@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>

From: Marc-André Lureau <mlureau@redhat.com>

Use only the modules defined in the NSS database.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
(cherry picked from commit ad2181f2b612cd8bf0a790faa2a1b51559f7234b)
---
 libcacard/vcard_emul_nss.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 libcacard/vcard_emul_nss.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c
index 57c6ee1..f0a5c2f 100644
--- a/libcacard/vcard_emul_nss.c
+++ b/libcacard/vcard_emul_nss.c
@@ -735,7 +735,7 @@ VCardEmulError
 vcard_emul_init(const VCardEmulOptions *options)
 {
     SECStatus rv;
-    PRBool ret, has_readers = PR_FALSE, need_coolkey_module;
+    PRBool ret, has_readers = PR_FALSE;
     VReader *vreader;
     VReaderEmul *vreader_emul;
     SECMODListLock *module_lock;
@@ -845,30 +845,15 @@ vcard_emul_init(const VCardEmulOptions *options)
     /* make sure we have some PKCS #11 module loaded */
     module_lock = SECMOD_GetDefaultModuleListLock();
     module_list = SECMOD_GetDefaultModuleList();
-    need_coolkey_module = !has_readers;
     SECMOD_GetReadLock(module_lock);
     for (mlp = module_list; mlp; mlp = mlp->next) {
         SECMODModule *module = mlp->module;
         if (module_has_removable_hw_slots(module)) {
-            need_coolkey_module = PR_FALSE;
             break;
         }
     }
     SECMOD_ReleaseReadLock(module_lock);
 
-    if (need_coolkey_module) {
-        SECMODModule *module;
-        module = SECMOD_LoadUserModule(
-                    (char *)"library=libcoolkeypk11.so name=Coolkey",
-                    NULL, PR_FALSE);
-        if (module == NULL) {
-            return VCARD_EMUL_FAIL;
-        }
-        SECMOD_DestroyModule(module); /* free our reference, Module will still
-                                       * be on the list.
-                                       * until we destroy it */
-    }
-
     /* now examine all the slots, finding which should be readers */
     /* We should control this with options. For now we mirror out any
      * removable hardware slot */
-- 
1.7.11.7

