diff options
-rw-r--r-- | Source/charon/sa/states/ike_sa_init_responded.c | 20 | ||||
-rw-r--r-- | Source/charon/utils/identification.h | 8 |
2 files changed, 17 insertions, 11 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; } diff --git a/Source/charon/utils/identification.h b/Source/charon/utils/identification.h index 199018382..9e0369dc8 100644 --- a/Source/charon/utils/identification.h +++ b/Source/charon/utils/identification.h @@ -32,7 +32,7 @@ typedef enum id_type_t id_type_t; /** * ID Types of a ID payload. * - * @ingroup payloads + * @ingroup utils */ enum id_type_t { /** @@ -96,7 +96,7 @@ typedef struct identification_t identification_t; * - ID_DER_ASN1_GN (not implemented) * - ID_KEY_ID (not implemented) * - * @ingroup sa + * @ingroup utils */ struct identification_t { @@ -155,7 +155,7 @@ struct identification_t { * @return - created identification_t object, or * - NULL if type not supported. * - * @ingroup sa + * @ingroup utils */ identification_t * identification_create_from_string(id_type_t type, char *string); @@ -168,7 +168,7 @@ identification_t * identification_create_from_string(id_type_t type, char *strin * @return - created identification_t object, or * - NULL if type not supported. * - * @ingroup sa + * @ingroup utils */ identification_t * identification_create_from_encoding(id_type_t type, chunk_t encoded); |