- fixed id bug
authorMartin Willi <martin@strongswan.org>
Fri, 2 Dec 2005 16:19:01 +0000 (16:19 -0000)
committerMartin Willi <martin@strongswan.org>
Fri, 2 Dec 2005 16:19:01 +0000 (16:19 -0000)
Source/charon/sa/states/ike_sa_init_responded.c
Source/charon/utils/identification.h

index ac8566d..a07dc5e 100644 (file)
@@ -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;
 }
 
index 1990183..9e0369d 100644 (file)
@@ -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);