summaryrefslogtreecommitdiff
path: root/src/libcharon/sa/ikev1/tasks/xauth.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-04-26 14:57:47 +0200
committerYves-Alexis Perez <corsac@debian.org>2013-04-26 14:57:47 +0200
commit10e5fb2b9b2f27c83b3e5a1d048b158d5cf42a43 (patch)
treebf1d05a2e37dbd1911b86fcc026fbe49b0239c71 /src/libcharon/sa/ikev1/tasks/xauth.c
parent7585facf05d927eb6df3929ce09ed5e60d905437 (diff)
downloadvyos-strongswan-10e5fb2b9b2f27c83b3e5a1d048b158d5cf42a43.tar.gz
vyos-strongswan-10e5fb2b9b2f27c83b3e5a1d048b158d5cf42a43.zip
Imported Upstream version 5.0.3
Diffstat (limited to 'src/libcharon/sa/ikev1/tasks/xauth.c')
-rw-r--r--src/libcharon/sa/ikev1/tasks/xauth.c66
1 files changed, 37 insertions, 29 deletions
diff --git a/src/libcharon/sa/ikev1/tasks/xauth.c b/src/libcharon/sa/ikev1/tasks/xauth.c
index 10bea5636..31114e592 100644
--- a/src/libcharon/sa/ikev1/tasks/xauth.c
+++ b/src/libcharon/sa/ikev1/tasks/xauth.c
@@ -286,21 +286,55 @@ METHOD(task_t, build_i_status, status_t,
return NEED_MORE;
}
+METHOD(task_t, process_i_status, status_t,
+ private_xauth_t *this, message_t *message)
+{
+ cp_payload_t *cp;
+
+ cp = (cp_payload_t*)message->get_payload(message, CONFIGURATION_V1);
+ if (!cp || cp->get_type(cp) != CFG_ACK)
+ {
+ DBG1(DBG_IKE, "received invalid XAUTH status response");
+ return FAILED;
+ }
+ if (this->status != XAUTH_OK)
+ {
+ DBG1(DBG_IKE, "destroying IKE_SA after failed XAuth authentication");
+ return FAILED;
+ }
+ if (!establish(this))
+ {
+ return FAILED;
+ }
+ this->ike_sa->set_condition(this->ike_sa, COND_XAUTH_AUTHENTICATED, TRUE);
+ lib->processor->queue_job(lib->processor, (job_t*)
+ adopt_children_job_create(this->ike_sa->get_id(this->ike_sa)));
+ return SUCCESS;
+}
+
METHOD(task_t, build_i, status_t,
private_xauth_t *this, message_t *message)
{
if (!this->xauth)
{
- cp_payload_t *cp;
+ cp_payload_t *cp = NULL;
this->xauth = load_method(this);
if (!this->xauth)
{
return FAILED;
}
- if (this->xauth->initiate(this->xauth, &cp) != NEED_MORE)
+ switch (this->xauth->initiate(this->xauth, &cp))
{
- return FAILED;
+ case NEED_MORE:
+ break;
+ case SUCCESS:
+ DESTROY_IF(cp);
+ this->status = XAUTH_OK;
+ this->public.task.process = _process_i_status;
+ return build_i_status(this, message);
+ default:
+ return FAILED;
}
message->add_payload(message, (payload_t *)cp);
return NEED_MORE;
@@ -411,32 +445,6 @@ METHOD(task_t, build_r, status_t,
return NEED_MORE;
}
-METHOD(task_t, process_i_status, status_t,
- private_xauth_t *this, message_t *message)
-{
- cp_payload_t *cp;
-
- cp = (cp_payload_t*)message->get_payload(message, CONFIGURATION_V1);
- if (!cp || cp->get_type(cp) != CFG_ACK)
- {
- DBG1(DBG_IKE, "received invalid XAUTH status response");
- return FAILED;
- }
- if (this->status != XAUTH_OK)
- {
- DBG1(DBG_IKE, "destroying IKE_SA after failed XAuth authentication");
- return FAILED;
- }
- if (!establish(this))
- {
- return FAILED;
- }
- this->ike_sa->set_condition(this->ike_sa, COND_XAUTH_AUTHENTICATED, TRUE);
- lib->processor->queue_job(lib->processor, (job_t*)
- adopt_children_job_create(this->ike_sa->get_id(this->ike_sa)));
- return SUCCESS;
-}
-
METHOD(task_t, process_i, status_t,
private_xauth_t *this, message_t *message)
{