- fixed bug
authorJan Hutter <jhutter@hsr.ch>
Mon, 12 Dec 2005 14:29:54 +0000 (14:29 -0000)
committerJan Hutter <jhutter@hsr.ch>
Mon, 12 Dec 2005 14:29:54 +0000 (14:29 -0000)
Source/charon/daemon.c
Source/charon/sa/ike_sa.c
Source/charon/sa/states/ike_sa_established.c

index 4f109f7..d5441ea 100644 (file)
@@ -161,7 +161,8 @@ static void build_test_jobs(private_daemon_t *this)
        char *config_name;
        initiate_ike_sa_job_t *initiate_job;
        
-       config_name = "localhost-rsa";
+       config_name = "pinflb30";
+//     config_name = "localhost-rsa";
        /* config_name = "localhost-shared"; */
        /* config_name = "localhost-bad_dh_group"; */
        
index bae5ea7..8908dab 100644 (file)
@@ -381,6 +381,9 @@ static void send_delete_ike_sa_request (private_ike_sa_t *this)
 {
        message_t *informational_request;
        delete_payload_t *delete_payload;
+       crypter_t *crypter;
+       signer_t *signer;
+       packet_t *packet;
        status_t status;
        
        if (this->current_state->get_state(this->current_state) != IKE_SA_ESTABLISHED)
@@ -396,12 +399,28 @@ static void send_delete_ike_sa_request (private_ike_sa_t *this)
                
        informational_request->add_payload(informational_request,(payload_t *)delete_payload);
        
-       status = this->protected.send_request(&(this->protected), informational_request);
+       if (this->ike_sa_id->is_initiator(this->ike_sa_id))
+       {
+               crypter = this->crypter_initiator;
+               signer = this->signer_initiator;
+       }
+       else
+       {
+               crypter = this->crypter_responder;
+               signer = this->signer_responder;
+       }
+       
+       status = informational_request->generate(informational_request,
+                                                                                        crypter,
+                                                                                        signer, &packet);
+       informational_request->destroy(informational_request);
        if (status != SUCCESS)
        {
-               this->logger->log(this->logger, AUDIT, "Unable to send INFORMATIONAL DELETE request");
-               informational_request->destroy(informational_request);
+               this->logger->log(this->logger, ERROR, "Could not generate packet from message");
+               return ;
        }
+       
+       charon->send_queue->add(charon->send_queue,packet);
 }
 
 /**
index b020fc9..183501d 100644 (file)
@@ -76,6 +76,7 @@ struct private_ike_sa_established_t {
 static status_t process_message(private_ike_sa_established_t *this, message_t *message)
 {
        delete_payload_t *delete_request = NULL;
+       ike_sa_id_t *ike_sa_id;
        iterator_t *payloads;
        message_t *response;
        crypter_t *crypter;
@@ -95,9 +96,19 @@ static status_t process_message(private_ike_sa_established_t *this, message_t *m
                return FAILED;
        }
        
+       ike_sa_id = this->ike_sa->public.get_id(&(this->ike_sa->public));
+       
        /* get signer for verification and crypter for decryption */
-       signer = this->ike_sa->get_signer_responder(this->ike_sa);
-       crypter = this->ike_sa->get_crypter_responder(this->ike_sa);
+       if (!ike_sa_id->is_initiator(ike_sa_id))
+       {
+               crypter = this->ike_sa->get_crypter_initiator(this->ike_sa);
+               signer = this->ike_sa->get_signer_initiator(this->ike_sa);
+       }
+       else
+       {
+               crypter = this->ike_sa->get_crypter_responder(this->ike_sa);
+               signer = this->ike_sa->get_signer_responder(this->ike_sa);
+       }
        
        /* parse incoming message */
        status = message->parse_body(message, crypter, signer);