- fixed id bug

This commit is contained in:
Martin Willi
2005-12-02 16:19:01 +00:00
parent 01de2f3cd5
commit 7ef7c3835a
2 changed files with 17 additions and 11 deletions
@@ -250,25 +250,31 @@ static status_t build_idr_payload(private_ike_sa_init_responded_t *this, id_payl
/* build new sa config */ /* build new sa config */
init_config = this->ike_sa->get_init_config(this->ike_sa); 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)); 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) if (status != SUCCESS)
{ {
this->logger->log(this->logger, ERROR, "Could not find config for %s", other_id->get_string(other_id)); 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; 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 */ /* set sa_config in ike_sa for other states */
this->ike_sa->set_sa_config(this->ike_sa, this->sa_config); this->ike_sa->set_sa_config(this->ike_sa, this->sa_config);
/* build response */ /* 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); response->add_payload(response, (payload_t*)idr_response);
if (my_id) my_id->destroy(my_id);
{
my_id->destroy(my_id);
}
other_id->destroy(other_id);
return SUCCESS; return SUCCESS;
} }
+4 -4
View File
@@ -32,7 +32,7 @@ typedef enum id_type_t id_type_t;
/** /**
* ID Types of a ID payload. * ID Types of a ID payload.
* *
* @ingroup payloads * @ingroup utils
*/ */
enum id_type_t { enum id_type_t {
/** /**
@@ -96,7 +96,7 @@ typedef struct identification_t identification_t;
* - ID_DER_ASN1_GN (not implemented) * - ID_DER_ASN1_GN (not implemented)
* - ID_KEY_ID (not implemented) * - ID_KEY_ID (not implemented)
* *
* @ingroup sa * @ingroup utils
*/ */
struct identification_t { struct identification_t {
@@ -155,7 +155,7 @@ struct identification_t {
* @return - created identification_t object, or * @return - created identification_t object, or
* - NULL if type not supported. * - NULL if type not supported.
* *
* @ingroup sa * @ingroup utils
*/ */
identification_t * identification_create_from_string(id_type_t type, char *string); 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 * @return - created identification_t object, or
* - NULL if type not supported. * - NULL if type not supported.
* *
* @ingroup sa * @ingroup utils
*/ */
identification_t * identification_create_from_encoding(id_type_t type, chunk_t encoded); identification_t * identification_create_from_encoding(id_type_t type, chunk_t encoded);