Defer certificate loading until all PKCS#11 modules are loaded
authorMartin Willi <martin@revosec.ch>
Tue, 20 Jul 2010 08:59:21 +0000 (10:59 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 4 Aug 2010 07:26:21 +0000 (09:26 +0200)
src/libstrongswan/plugins/pkcs11/pkcs11_manager.c

index 5840600..204a954 100644 (file)
@@ -374,17 +374,22 @@ pkcs11_manager_t *pkcs11_manager_create(pkcs11_manager_token_event_t cb,
                        free(entry);
                        continue;
                }
+               this->libs->insert_last(this->libs, entry);
+       }
+       enumerator->destroy(enumerator);
+
+       singleton = this;
 
+       enumerator = this->libs->create_enumerator(this->libs);
+       while (enumerator->enumerate(enumerator, &entry))
+       {
                query_slots(entry);
-               this->libs->insert_last(this->libs, entry);
                entry->job = callback_job_create((void*)dispatch_slot_events,
                                                                                 entry, (void*)end_dispatch, NULL);
                charon->processor->queue_job(charon->processor, (job_t*)entry->job);
        }
        enumerator->destroy(enumerator);
 
-       singleton = this;
-
        return &this->public;
 }