mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-09 00:00:53 -04:00
If adding an IMC/IMV fails, terminate() it only if it has been initialize()d
This commit is contained in:
parent
fd885fd390
commit
be18ee8123
@ -51,7 +51,6 @@ METHOD(imc_manager_t, add, bool,
|
|||||||
{
|
{
|
||||||
TNC_Version version;
|
TNC_Version version;
|
||||||
|
|
||||||
/* Initialize the module */
|
|
||||||
imc->set_id(imc, this->next_imc_id);
|
imc->set_id(imc, this->next_imc_id);
|
||||||
if (imc->initialize(imc->get_id(imc), TNC_IFIMC_VERSION_1,
|
if (imc->initialize(imc->get_id(imc), TNC_IFIMC_VERSION_1,
|
||||||
TNC_IFIMC_VERSION_1, &version) != TNC_RESULT_SUCCESS)
|
TNC_IFIMC_VERSION_1, &version) != TNC_RESULT_SUCCESS)
|
||||||
@ -62,15 +61,18 @@ METHOD(imc_manager_t, add, bool,
|
|||||||
this->imcs->insert_last(this->imcs, imc);
|
this->imcs->insert_last(this->imcs, imc);
|
||||||
this->next_imc_id++;
|
this->next_imc_id++;
|
||||||
|
|
||||||
if (imc->provide_bind_function(imc->get_id(imc), TNC_TNCC_BindFunction)
|
if (imc->provide_bind_function(imc->get_id(imc),
|
||||||
!= TNC_RESULT_SUCCESS)
|
TNC_TNCC_BindFunction) != TNC_RESULT_SUCCESS)
|
||||||
{
|
{
|
||||||
|
if (imc->terminate)
|
||||||
|
{
|
||||||
|
imc->terminate(imc->get_id(imc));
|
||||||
|
}
|
||||||
DBG1(DBG_TNC, "IMC \"%s\" failed to obtain bind function",
|
DBG1(DBG_TNC, "IMC \"%s\" failed to obtain bind function",
|
||||||
imc->get_name(imc));
|
imc->get_name(imc));
|
||||||
this->imcs->remove_last(this->imcs, (void**)&imc);
|
this->imcs->remove_last(this->imcs, (void**)&imc);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,12 +109,6 @@ METHOD(imc_manager_t, load, bool,
|
|||||||
}
|
}
|
||||||
if (!add(this, imc))
|
if (!add(this, 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);
|
imc->destroy(imc);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,6 @@ METHOD(imv_manager_t, add, bool,
|
|||||||
{
|
{
|
||||||
TNC_Version version;
|
TNC_Version version;
|
||||||
|
|
||||||
/* Initialize the IMV module */
|
|
||||||
imv->set_id(imv, this->next_imv_id);
|
imv->set_id(imv, this->next_imv_id);
|
||||||
if (imv->initialize(imv->get_id(imv), TNC_IFIMV_VERSION_1,
|
if (imv->initialize(imv->get_id(imv), TNC_IFIMV_VERSION_1,
|
||||||
TNC_IFIMV_VERSION_1, &version) != TNC_RESULT_SUCCESS)
|
TNC_IFIMV_VERSION_1, &version) != TNC_RESULT_SUCCESS)
|
||||||
@ -78,15 +77,18 @@ METHOD(imv_manager_t, add, bool,
|
|||||||
this->imvs->insert_last(this->imvs, imv);
|
this->imvs->insert_last(this->imvs, imv);
|
||||||
this->next_imv_id++;
|
this->next_imv_id++;
|
||||||
|
|
||||||
if (imv->provide_bind_function(imv->get_id(imv), TNC_TNCS_BindFunction)
|
if (imv->provide_bind_function(imv->get_id(imv),
|
||||||
!= TNC_RESULT_SUCCESS)
|
TNC_TNCS_BindFunction) != TNC_RESULT_SUCCESS)
|
||||||
{
|
{
|
||||||
DBG1(DBG_TNC, "IMV \"%s\" could failed to obtain bind function",
|
if (imv->terminate)
|
||||||
|
{
|
||||||
|
imv->terminate(imv->get_id(imv));
|
||||||
|
}
|
||||||
|
DBG1(DBG_TNC, "IMV \"%s\" failed to obtain bind function",
|
||||||
imv->get_name(imv));
|
imv->get_name(imv));
|
||||||
this->imvs->remove_last(this->imvs, (void**)&imv);
|
this->imvs->remove_last(this->imvs, (void**)&imv);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,12 +125,6 @@ METHOD(imv_manager_t, load, bool,
|
|||||||
}
|
}
|
||||||
if (!add(this, imv))
|
if (!add(this, imv))
|
||||||
{
|
{
|
||||||
if (imv->terminate &&
|
|
||||||
imv->terminate(imv->get_id(imv)) != TNC_RESULT_SUCCESS)
|
|
||||||
{
|
|
||||||
DBG1(DBG_TNC, "IMV \"%s\" not terminated successfully",
|
|
||||||
imv->get_name(imv));
|
|
||||||
}
|
|
||||||
imv->destroy(imv);
|
imv->destroy(imv);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user