terminate imc/imv that couldn't be initialized properly
[strongswan.git] / src / libcharon / plugins / tnc_imc / tnc_imc_plugin.c
index c132f39..bc13b87 100644 (file)
@@ -130,6 +130,12 @@ static bool load_imcs(char *filename)
                }
                if (!charon->imcs->add(charon->imcs, imc))
                {
+                       if (imc->terminate &&
+                               imc->terminate(imc->get_id(imc)) != TNC_RESULT_SUCCESS)
+                       {
+                               DBG1(DBG_TNC, "IMC \"%s\" not terminated successfully",
+                                                          imc->get_name(imc));
+                       }
                        imc->destroy(imc);
                        return FALSE;
                }
@@ -141,6 +147,12 @@ static bool load_imcs(char *filename)
        return TRUE;
 }
 
+METHOD(plugin_t, get_name, char*,
+       tnc_imc_plugin_t *this)
+{
+       return "tnc-imc";
+}
+
 METHOD(plugin_t, destroy, void,
        tnc_imc_plugin_t *this)
 {
@@ -158,6 +170,8 @@ plugin_t *tnc_imc_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
+                               .reload = (void*)return_false,
                        .destroy = _destroy,
                },
        );
@@ -171,6 +185,7 @@ plugin_t *tnc_imc_plugin_create()
        if (!load_imcs(tnc_config))
        {
                charon->imcs->destroy(charon->imcs);
+               charon->imcs = NULL;
                free(this);
                return NULL;
        }