{
task_t *task;
+ if (this->queued)
+ {
+ this->queued->destroy(this->queued);
+ this->queued = NULL;
+ }
while (list->remove_last(list, (void**)&task) == SUCCESS)
{
task->destroy(task);
}
break;
case IKE_CONNECTING:
+ if (activate_task(this, TASK_ISAKMP_DELETE))
+ {
+ exchange = INFORMATIONAL_V1;
+ new_mid = TRUE;
+ break;
+ }
if (activate_task(this, TASK_XAUTH))
{
exchange = TRANSACTION;
new_mid = TRUE;
+ break;
}
if (activate_task(this, TASK_INFORMATIONAL))
{
exchange = INFORMATIONAL_V1;
new_mid = TRUE;
+ break;
}
break;
case IKE_ESTABLISHED:
{
exchange = INFORMATIONAL_V1;
new_mid = TRUE;
+ break;
}
if (activate_task(this, TASK_ISAKMP_DELETE))
{
exchange = INFORMATIONAL_V1;
new_mid = TRUE;
+ break;
}
if (activate_task(this, TASK_QUICK_DELETE))
{
exchange = INFORMATIONAL_V1;
new_mid = TRUE;
+ break;
}
break;
default:
#include <sa/tasks/xauth.h>
#include <sa/tasks/mode_config.h>
#include <sa/tasks/informational.h>
+#include <sa/tasks/isakmp_delete.h>
typedef struct private_main_mode_t private_main_mode_t;
return ALREADY_DONE;
}
+/**
+ * Queue a delete task if authentication failed as initiator
+ */
+static status_t send_delete(private_main_mode_t *this)
+{
+ this->ike_sa->queue_task(this->ike_sa,
+ (task_t*)isakmp_delete_create(this->ike_sa, TRUE));
+ /* cancel all active tasks in favour of informational */
+ return ALREADY_DONE;
+}
+
METHOD(task_t, build_i, status_t,
private_main_mode_t *this, message_t *message)
{
if (!id_payload)
{
DBG1(DBG_IKE, "IDir payload missing");
- return send_notify(this, INVALID_PAYLOAD_TYPE);
+ return send_delete(this);
}
id = id_payload->get_identification(id_payload);
if (!id->matches(id, this->other_auth->get(this->other_auth,
{
DBG1(DBG_IKE, "IDir does not match");
id->destroy(id);
- return send_notify(this, INVALID_ID_INFORMATION);
+ return send_delete(this);
}
this->ike_sa->set_other_id(this->ike_sa, id);
message) != SUCCESS)
{
DESTROY_IF(authenticator);
- return send_notify(this, AUTHENTICATION_FAILED);
+ return send_delete(this);
}
authenticator->destroy(authenticator);
if (!check_constraints(this))
{
- return send_notify(this, AUTHENTICATION_FAILED);
+ return send_delete(this);
}
save_auth_cfg(this, FALSE);