]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Make sure the certificate cache is flushed when plugins are unloaded.
authorTobias Brunner <tobias@strongswan.org>
Thu, 15 Dec 2011 11:20:09 +0000 (12:20 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 15 Dec 2011 11:20:09 +0000 (12:20 +0100)
This avoids segmentation faults when plugins implementing cert_t are
already unloaded when the cache is flushed during destruction.

src/libcharon/daemon.c
src/libstrongswan/library.c
src/pluto/plutomain.c

index b8dc52a602029fa2133815ddac131871805451dd..5b79aa303380b44ddb44674990e32555efed63b5 100644 (file)
@@ -115,6 +115,8 @@ static void destroy(private_daemon_t *this)
        DESTROY_IF(this->public.connect_manager);
        DESTROY_IF(this->public.mediation_manager);
 #endif /* ME */
+       /* make sure the cache is clear before unloading plugins */
+       lib->credmgr->flush_cache(lib->credmgr, CERT_ANY);
        /* unload plugins to release threads */
        lib->plugins->unload(lib->plugins);
 #ifdef CAPABILITIES_LIBCAP
index 6ed4d12859ad7065acd927422c7c21a6357924f0..cd6a41f4405ba2f81a0eaa6e35daad94d444140f 100644 (file)
@@ -61,6 +61,9 @@ void library_deinit()
        detailed = lib->settings->get_bool(lib->settings,
                                                                "libstrongswan.leak_detective.detailed", TRUE);
 
+       /* make sure the cache is clear before unloading plugins */
+       lib->credmgr->flush_cache(lib->credmgr, CERT_ANY);
+
        this->public.scheduler->destroy(this->public.scheduler);
        this->public.processor->destroy(this->public.processor);
        this->public.plugins->destroy(this->public.plugins);
index db5f2d941c8861a0fa5139f19ca5c33a3bafe191..2e046ec0b6ec10e5dc11ce3748a538bb96366220 100644 (file)
@@ -852,6 +852,7 @@ void exit_pluto(int status)
        delete_lock();
        options->destroy(options);
        pluto_deinit();
+       lib->credmgr->flush_cache(lib->credmgr, CERT_ANY);
        lib->plugins->unload(lib->plugins);
        libhydra_deinit();
        library_deinit();