aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/sa/states/ike_sa_init_responded.c
diff options
context:
space:
mode:
Diffstat (limited to 'Source/charon/sa/states/ike_sa_init_responded.c')
-rw-r--r--Source/charon/sa/states/ike_sa_init_responded.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/Source/charon/sa/states/ike_sa_init_responded.c b/Source/charon/sa/states/ike_sa_init_responded.c
index ac8566d00..a07dc5ecc 100644
--- a/Source/charon/sa/states/ike_sa_init_responded.c
+++ b/Source/charon/sa/states/ike_sa_init_responded.c
@@ -250,25 +250,31 @@ static status_t build_idr_payload(private_ike_sa_init_responded_t *this, id_payl
/* build new sa config */
init_config = this->ike_sa->get_init_config(this->ike_sa);
status = charon->configuration_manager->get_sa_config_for_init_config_and_id(charon->configuration_manager,init_config, other_id,my_id, &(this->sa_config));
+ other_id->destroy(other_id);
if (status != SUCCESS)
{
this->logger->log(this->logger, ERROR, "Could not find config for %s", other_id->get_string(other_id));
+ if (my_id)
+ {
+ my_id->destroy(my_id);
+ }
return NOT_FOUND;
}
+ /* get my id, if not requested */
+ if (!my_id)
+ {
+ my_id = this->sa_config->get_my_id(this->sa_config);
+ }
+
/* set sa_config in ike_sa for other states */
this->ike_sa->set_sa_config(this->ike_sa, this->sa_config);
/* build response */
- idr_response = id_payload_create_from_identification(FALSE, other_id);
+ idr_response = id_payload_create_from_identification(FALSE, my_id);
response->add_payload(response, (payload_t*)idr_response);
- if (my_id)
- {
- my_id->destroy(my_id);
- }
- other_id->destroy(other_id);
-
+ my_id->destroy(my_id);
return SUCCESS;
}