diff options
| author | Clavister OpenSource <opensource@clavister.com> | 2011-11-29 09:24:29 +0100 |
|---|---|---|
| committer | Clavister OpenSource <opensource@clavister.com> | 2012-03-20 17:31:09 +0100 |
| commit | 2e210e3ef5e798dd194318c5a8a8a24271684dd3 (patch) | |
| tree | 107065ee50d4c2e9161562fbc86890312685e840 /src/libcharon/processing | |
| parent | 65359ccbbc0540d719d56d4d8de7e0d94c498145 (diff) | |
| download | strongswan-2e210e3ef5e798dd194318c5a8a8a24271684dd3.tar.bz2 strongswan-2e210e3ef5e798dd194318c5a8a8a24271684dd3.tar.xz | |
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.
Diffstat (limited to 'src/libcharon/processing')
| -rw-r--r-- | src/libcharon/processing/jobs/initiate_xauth_job.c | 85 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/initiate_xauth_job.h | 49 |
2 files changed, 134 insertions, 0 deletions
diff --git a/src/libcharon/processing/jobs/initiate_xauth_job.c b/src/libcharon/processing/jobs/initiate_xauth_job.c new file mode 100644 index 000000000..0ec12dfdb --- /dev/null +++ b/src/libcharon/processing/jobs/initiate_xauth_job.c @@ -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; +} diff --git a/src/libcharon/processing/jobs/initiate_xauth_job.h b/src/libcharon/processing/jobs/initiate_xauth_job.h new file mode 100644 index 000000000..90271414d --- /dev/null +++ b/src/libcharon/processing/jobs/initiate_xauth_job.h @@ -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_ @}*/ |
