IKEv1 XAuth: Added a job to call the initiate_xauth method of ike_sa after the completion of the current set of tasks is complete.

This commit is contained in:
Clavister OpenSource
2012-03-20 17:31:09 +01:00
parent 65359ccbbc
commit 2e210e3ef5
3 changed files with 135 additions and 0 deletions
+1
View File
@@ -57,6 +57,7 @@ processing/jobs/start_action_job.c processing/jobs/start_action_job.h \
processing/jobs/roam_job.c processing/jobs/roam_job.h \
processing/jobs/update_sa_job.c processing/jobs/update_sa_job.h \
processing/jobs/inactivity_job.c processing/jobs/inactivity_job.h \
processing/jobs/initiate_xauth_job.c processing/jobs/initiate_xauth_job.h \
sa/authenticators/authenticator.c sa/authenticators/authenticator.h \
sa/authenticators/eap_authenticator.c sa/authenticators/eap_authenticator.h \
sa/authenticators/eap/eap_method.c sa/authenticators/eap/eap_method.h \
@@ -0,0 +1,85 @@
/*
* Copyright (C) 2007-2008 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "initiate_xauth_job.h"
#include <sa/ike_sa.h>
#include <daemon.h>
typedef struct private_initiate_xauth_job_t private_initiate_xauth_job_t;
/**
* Private data of an initiate_xauth_job_t Object
*/
struct private_initiate_xauth_job_t {
/**
* public initiate_xauth_job_t interface
*/
initiate_xauth_job_t public;
/**
* ID of the IKE_SA of the mediated connection.
*/
ike_sa_id_t *ike_sa_id;
};
METHOD(job_t, destroy, void,
private_initiate_xauth_job_t *this)
{
DESTROY_IF(this->ike_sa_id);
free(this);
}
METHOD(job_t, initiate, void,
private_initiate_xauth_job_t *this)
{
ike_sa_t *ike_sa;
ike_sa = charon->ike_sa_manager->checkout(charon->ike_sa_manager,
this->ike_sa_id);
if (ike_sa)
{
DBG1(DBG_IKE, "INITIATING XAUTH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
ike_sa->initiate_xauth(ike_sa);
charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa);
}
destroy(this);
}
METHOD(job_t, get_priority, job_priority_t,
private_initiate_xauth_job_t *this)
{
return JOB_PRIO_MEDIUM;
}
/**
* Creates an empty job
*/
initiate_xauth_job_t *initiate_xauth_job_create(ike_sa_id_t *ike_sa_id)
{
private_initiate_xauth_job_t *this;
INIT(this,
.public = {
.job_interface = {
.get_priority = _get_priority,
.destroy = _destroy,
.execute = _initiate,
},
},
.ike_sa_id = ike_sa_id->clone(ike_sa_id),
);
return &this->public;
}
@@ -0,0 +1,49 @@
/*
* Copyright (C) 2007-2008 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
* @defgroup initiate_xauth_job initiate_xauth_job
* @{ @ingroup cjobs
*/
#ifndef INITIATE_XAUTH_JOB_H_
#define INITIATE_XAUTH_JOB_H_
typedef struct initiate_xauth_job_t initiate_xauth_job_t;
#include <processing/jobs/job.h>
#include <sa/ike_sa_id.h>
/**
* Class representing a INITIATE_XAUTH Job.
*
* This job will an XAuth authentication exchange.
*/
struct initiate_xauth_job_t {
/**
* implements job_t interface
*/
job_t job_interface;
};
/**
* Creates a job of type INITIATE_XAUTH.
*
* @param ike_sa_id_t identification of the ike_sa as ike_sa_id_t object (gets cloned)
* @return job object
*/
initiate_xauth_job_t *initiate_xauth_job_create(ike_sa_id_t *ike_sa_id);
#endif /** INITIATE_XAUTH_JOB_H_ @}*/