Fix IKEv1 DELETE subtask creation and processing
authorMartin Willi <martin@revosec.ch>
Tue, 13 Dec 2011 09:35:18 +0000 (10:35 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 20 Mar 2012 16:31:19 +0000 (17:31 +0100)
src/libcharon/sa/tasks/informational.c

index c1a30e4..c2c6aa5 100644 (file)
@@ -94,15 +94,19 @@ METHOD(task_t, process_r, status_t,
                                }
                                continue;
                        case DELETE_V1:
-                               delete = (delete_payload_t*)payload;
-                               if (delete->get_protocol_id(delete) == PROTO_IKE)
+                               if (!this->del)
                                {
-                                       this->del = (task_t*)ike_delete_create(this->ike_sa, FALSE);
-                               }
-                               else
-                               {
-                                       this->del = (task_t*)child_delete_create(this->ike_sa,
-                                                                                                                        PROTO_NONE, 0);
+                                       delete = (delete_payload_t*)payload;
+                                       if (delete->get_protocol_id(delete) == PROTO_IKE)
+                                       {
+                                               this->del = (task_t*)ike_delete_create(this->ike_sa,
+                                                                                                                          FALSE);
+                                       }
+                                       else
+                                       {
+                                               this->del = (task_t*)child_delete_create(this->ike_sa,
+                                                                                                                                PROTO_NONE, 0);
+                                       }
                                }
                                break;
                        default:
@@ -112,7 +116,7 @@ METHOD(task_t, process_r, status_t,
        }
        enumerator->destroy(enumerator);
 
-       if (status == SUCCESS)
+       if (this->del && status == SUCCESS)
        {
                return this->del->process(this->del, message);
        }