diff options
author | Martin Willi <martin@revosec.ch> | 2011-12-08 15:38:28 +0000 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-03-20 17:31:15 +0100 |
commit | 4e73f85b818c3abf48f5c5ae3db98cc6be7dd34f (patch) | |
tree | 788fce5884e309a89508b035d2164c5363b7d2b9 /src | |
parent | 96c9159d9601112b89a40b609035e7cf210a2050 (diff) | |
download | strongswan-4e73f85b818c3abf48f5c5ae3db98cc6be7dd34f.tar.bz2 strongswan-4e73f85b818c3abf48f5c5ae3db98cc6be7dd34f.tar.xz |
Remove xauth_authenticator, we handle it in the task
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/Makefile.am | 1 | ||||
-rw-r--r-- | src/libcharon/sa/authenticators/xauth_authenticator.c | 175 | ||||
-rw-r--r-- | src/libcharon/sa/authenticators/xauth_authenticator.h | 55 |
3 files changed, 0 insertions, 231 deletions
diff --git a/src/libcharon/Makefile.am b/src/libcharon/Makefile.am index 3bddf0e61..0ff9a35b1 100644 --- a/src/libcharon/Makefile.am +++ b/src/libcharon/Makefile.am @@ -65,7 +65,6 @@ sa/authenticators/psk_authenticator.c sa/authenticators/psk_authenticator.h \ sa/authenticators/pubkey_authenticator.c sa/authenticators/pubkey_authenticator.h \ sa/authenticators/psk_v1_authenticator.c sa/authenticators/psk_v1_authenticator.h \ sa/authenticators/pubkey_v1_authenticator.c sa/authenticators/pubkey_v1_authenticator.h \ -sa/authenticators/xauth_authenticator.c sa/authenticators/xauth_authenticator.h \ sa/authenticators/xauth/xauth_method.c sa/authenticators/xauth/xauth_method.h \ sa/authenticators/xauth/xauth_manager.c sa/authenticators/xauth/xauth_manager.h \ sa/child_sa.c sa/child_sa.h \ diff --git a/src/libcharon/sa/authenticators/xauth_authenticator.c b/src/libcharon/sa/authenticators/xauth_authenticator.c deleted file mode 100644 index 871817d70..000000000 --- a/src/libcharon/sa/authenticators/xauth_authenticator.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2005-2009 Martin Willi - * Copyright (C) 2005 Jan Hutter - * 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 "xauth_authenticator.h" - -#include <daemon.h> -#include <encoding/payloads/cp_payload.h> -#include <sa/keymat_v2.h> - -typedef struct private_xauth_authenticator_t private_xauth_authenticator_t; - -/** - * Private data of an xauth_authenticator_t object. - */ -struct private_xauth_authenticator_t { - - /** - * Public authenticator_t interface. - */ - xauth_authenticator_t public; - - /** - * Assigned IKE_SA - */ - ike_sa_t *ike_sa; - - /** - * The payload to send - */ - cp_payload_t *cp_payload; - - /** - * Whether the authenticator is for an XAUTH server or client - */ - xauth_role_t role; -}; - -/** - * load an XAuth method - */ -static xauth_method_t *load_method(private_xauth_authenticator_t *this, - xauth_type_t type, u_int32_t vendor) -{ - identification_t *server, *peer, *aaa; - auth_cfg_t *auth; - - if (this->role == XAUTH_SERVER) - { - server = this->ike_sa->get_my_id(this->ike_sa); - peer = this->ike_sa->get_other_id(this->ike_sa); - auth = this->ike_sa->get_auth_cfg(this->ike_sa, FALSE); - } - else - { - server = this->ike_sa->get_other_id(this->ike_sa); - peer = this->ike_sa->get_my_id(this->ike_sa); - auth = this->ike_sa->get_auth_cfg(this->ike_sa, TRUE); - } - aaa = auth->get(auth, AUTH_RULE_AAA_IDENTITY); - if (aaa) - { - server = aaa; - } - return charon->xauth->create_instance(charon->xauth, type, vendor, - this->role, server, peer); -} - -METHOD(authenticator_t, build, status_t, - private_xauth_authenticator_t *this, message_t *message) -{ - if(this->cp_payload != NULL) - { - message->add_payload(message, (payload_t *)this->cp_payload); - return NEED_MORE; - } - return SUCCESS; -} - -METHOD(authenticator_t, process, status_t, - private_xauth_authenticator_t *this, message_t *message) -{ - xauth_method_t *xauth_method = NULL; - cp_payload_t *cp_in, *cp_out; - status_t status = FAILED; - - cp_in = (cp_payload_t *)message->get_payload(message, CONFIGURATION_V1); - - xauth_method = load_method(this, XAUTH_NULL, 0); - - if(xauth_method != NULL) - { - status = xauth_method->process(xauth_method, cp_in, &cp_out); - if(status == NEED_MORE) - { - this->cp_payload = cp_out; - } - else - { - xauth_method->destroy(xauth_method); - } - } - else - { - DBG1(DBG_IKE, "Couldn't locate valid xauth method."); - } - - return status; -} - -METHOD(authenticator_t, destroy, void, - private_xauth_authenticator_t *this) -{ - free(this); -} - -/* - * Described in header. - */ -xauth_authenticator_t *xauth_authenticator_create_builder(ike_sa_t *ike_sa) -{ - private_xauth_authenticator_t *this; - - INIT(this, - .public = { - .authenticator = { - .build = _build, - .process = _process, - .is_mutual = (void*)return_false, - .destroy = _destroy, - }, - }, - .ike_sa = ike_sa, - .cp_payload = NULL, - .role = XAUTH_PEER, - ); - - return &this->public; -} - -/* - * Described in header. - */ -xauth_authenticator_t *xauth_authenticator_create_verifier(ike_sa_t *ike_sa) -{ - private_xauth_authenticator_t *this; - - INIT(this, - .public = { - .authenticator = { - .build = _build, - .process = _process, - .is_mutual = (void*)return_false, - .destroy = _destroy, - }, - }, - .ike_sa = ike_sa, - .cp_payload = NULL, - .role = XAUTH_SERVER, - ); - - return &this->public; -} diff --git a/src/libcharon/sa/authenticators/xauth_authenticator.h b/src/libcharon/sa/authenticators/xauth_authenticator.h deleted file mode 100644 index d316b1672..000000000 --- a/src/libcharon/sa/authenticators/xauth_authenticator.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2006-2009 Martin Willi - * 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 xauth_authenticator xauth_authenticator - * @{ @ingroup authenticators - */ - -#ifndef XAUTH_AUTHENTICATOR_H_ -#define XAUTH_AUTHENTICATOR_H_ - -typedef struct xauth_authenticator_t xauth_authenticator_t; - -#include <sa/authenticators/authenticator.h> - -/** - * Implementation of authenticator_t using XAuth. - */ -struct xauth_authenticator_t { - - /** - * Implemented authenticator_t interface. - */ - authenticator_t authenticator; -}; - -/** - * Create an authenticator to build XAuth response payloads. - * - * @param ike_sa associated ike_sa - * @return PSK authenticator - */ -xauth_authenticator_t *xauth_authenticator_create_builder(ike_sa_t *ike_sa); - -/** - * Create an authenticator to verify using XAuth payloads. - * - * @param ike_sa associated ike_sa - * @return PSK authenticator - */ -xauth_authenticator_t *xauth_authenticator_create_verifier(ike_sa_t *ike_sa); - -#endif /** XAUTH_AUTHENTICATOR_H_ @}*/ |