]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Make IKE/EAP IDs available to TNC server/client
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 17 Jan 2013 22:32:34 +0000 (23:32 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 11 Feb 2013 14:30:44 +0000 (15:30 +0100)
src/libcharon/plugins/eap_tnc/eap_tnc.c
src/libcharon/plugins/tnc_tnccs/tnc_tnccs_manager.c
src/libcharon/plugins/tnccs_11/tnccs_11.c
src/libcharon/plugins/tnccs_11/tnccs_11.h
src/libcharon/plugins/tnccs_20/tnccs_20.c
src/libcharon/plugins/tnccs_20/tnccs_20.h
src/libcharon/plugins/tnccs_dynamic/tnccs_dynamic.c
src/libcharon/plugins/tnccs_dynamic/tnccs_dynamic.h
src/libtnccs/tnc/tnccs/tnccs.h
src/libtnccs/tnc/tnccs/tnccs_manager.h

index ffa1bae39421f783b4bdb2bb1ec603505b1f3675..6d76710f5bdf20675ccf5a4a33f9ead48abdc128 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2012 Andreas Steffen
+ * Copyright (C) 2010-2013 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -172,7 +172,8 @@ static eap_tnc_t *eap_tnc_create(identification_t *server,
                free(this);
                return NULL;
        }
-       tnccs = tnc->tnccs->create_instance(tnc->tnccs, type, is_server);
+       tnccs = tnc->tnccs->create_instance(tnc->tnccs, type, is_server,
+                                                                               server, peer);
        this->tls_eap = tls_eap_create(EAP_TNC, (tls_t*)tnccs,
                                                                                         EAP_TNC_MAX_MESSAGE_LEN,
                                                                                         max_msg_count, FALSE);
index 0b623d6ffcf486ce79ddb077d7f8b44dd3a7f78c..8e69476b63840fe1adcdc010674b76cc1cfc4f45 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2012 Andreas Steffen
+ * Copyright (C) 2010-2013 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -158,7 +158,8 @@ METHOD(tnccs_manager_t, remove_method, void,
 }
 
 METHOD(tnccs_manager_t, create_instance, tnccs_t*,
-       private_tnc_tnccs_manager_t *this, tnccs_type_t type, bool is_server)
+       private_tnc_tnccs_manager_t *this, tnccs_type_t type, bool is_server,
+       identification_t *server, identification_t *peer)
 {
        enumerator_t *enumerator;
        tnccs_entry_t *entry;
@@ -170,7 +171,7 @@ METHOD(tnccs_manager_t, create_instance, tnccs_t*,
        {
                if (type == entry->type)
                {
-                       protocol = entry->constructor(is_server);
+                       protocol = entry->constructor(is_server, server, peer);
                        if (protocol)
                        {
                                break;
index cfc29d6abdabb487b89780aa7fe38b79f2f0bb5a..c1224af7577f339305eac8a75c34c87c0bbbc8e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2012 Andreas Steffen
+ * Copyright (C) 2010-2013 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -52,6 +52,16 @@ struct private_tnccs_11_t {
         */
        bool is_server;
 
+       /**
+        * Server identity
+        */
+       identification_t *server;
+
+       /**
+        * Client identity
+        */
+       identification_t *peer;
+
        /**
         * Connection ID assigned to this TNCCS connection
         */
@@ -528,6 +538,8 @@ METHOD(tls_t, destroy, void,
 {
        tnc->tnccs->remove_connection(tnc->tnccs, this->connection_id,
                                                                                          this->is_server);
+       this->server->destroy(this->server);
+       this->peer->destroy(this->peer);
        this->mutex->destroy(this->mutex);
        DESTROY_IF(this->batch);
        free(this);
@@ -536,7 +548,8 @@ METHOD(tls_t, destroy, void,
 /**
  * See header
  */
-tls_t *tnccs_11_create(bool is_server)
+tls_t *tnccs_11_create(bool is_server, identification_t *server,
+                                          identification_t *peer)
 {
        private_tnccs_11_t *this;
 
@@ -551,6 +564,8 @@ tls_t *tnccs_11_create(bool is_server)
                        .destroy = _destroy,
                },
                .is_server = is_server,
+               .server = server->clone(server),
+               .peer = peer->clone(peer),
                .mutex = mutex_create(MUTEX_TYPE_DEFAULT),
                .max_msg_len = lib->settings->get_int(lib->settings,
                                                                "%s.plugins.tnccs-11.max_message_size", 45000,
index 7331fc8cd3e637bd512bcdc0eec37f9977048214..79fccf9c79c8a476bd0c8438b92ab472d2ae6e27 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Andreas Steffen
+ * Copyright (C) 2010-2013 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
 /**
  * Create an instance of the TNC IF-TNCCS 1.1 protocol handler.
  *
- * @param is_server                    TRUE to act as TNC Server, FALSE for TNC Client
- * @return                                     TNC_IF_TNCCS 1.1 protocol stack
+ * @param is_server            TRUE to act as TNC Server, FALSE for TNC Client
+ * @param server               Server identity
+ * @param peer                 Client identity
+ * @return                             TNC_IF_TNCCS 1.1 protocol stack
  */
-tls_t *tnccs_11_create(bool is_server);
+tls_t *tnccs_11_create(bool is_server, identification_t *server,
+                                          identification_t *peer);
 
 #endif /** TNCCS_11_H_ @}*/
index 6239b152d6fefb2f087fbf09575b700495a2ce65..1e06c1a479b8ecfd67ad91724ac3e052ffcf95c5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010 Sansar Choinyanbuu
- * Copyright (C) 2010-2012 Andreas Steffen
+ * Copyright (C) 2010-2013 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -57,6 +57,16 @@ struct private_tnccs_20_t {
         */
        bool is_server;
 
+       /**
+        * Server identity
+        */
+       identification_t *server;
+
+       /**
+        * Client identity
+        */
+       identification_t *peer;
+
        /**
         * PB-TNC State Machine
         */
@@ -792,6 +802,8 @@ METHOD(tls_t, destroy, void,
 {
        tnc->tnccs->remove_connection(tnc->tnccs, this->connection_id,
                                                                                          this->is_server);
+       this->server->destroy(this->server);
+       this->peer->destroy(this->peer);
        this->state_machine->destroy(this->state_machine);
        this->mutex->destroy(this->mutex);
        this->messages->destroy_offset(this->messages,
@@ -802,7 +814,8 @@ METHOD(tls_t, destroy, void,
 /**
  * See header
  */
-tls_t *tnccs_20_create(bool is_server)
+tls_t *tnccs_20_create(bool is_server, identification_t *server,
+                                          identification_t *peer)
 {
        private_tnccs_20_t *this;
 
@@ -817,6 +830,8 @@ tls_t *tnccs_20_create(bool is_server)
                        .destroy = _destroy,
                },
                .is_server = is_server,
+               .server = server->clone(server),
+               .peer = peer->clone(peer),
                .state_machine = pb_tnc_state_machine_create(is_server),
                .mutex = mutex_create(MUTEX_TYPE_DEFAULT),
                .messages = linked_list_create(),
index 400d1dc12f344698076fdbf5da690b3796af5a91..d42ebf218abb302768765a3b3142303a878b72d1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Andreas Steffen
+ * Copyright (C) 2010-2013 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
 /**
  * Create an instance of the TNC IF-TNCCS 2.0 protocol handler.
  *
- * @param is_server                    TRUE to act as TNC Server, FALSE for TNC Client
- * @return                                     TNC_IF_TNCCS 2.0 protocol stack
+ * @param is_server            TRUE to act as TNC Server, FALSE for TNC Client
+ * @param server               Server identity
+ * @param peer                 Client identity
+ * @return                             TNC_IF_TNCCS 2.0 protocol stack
  */
-tls_t *tnccs_20_create(bool is_server);
+tls_t *tnccs_20_create(bool is_server, identification_t *server,
+                                          identification_t *peer);
 
 #endif /** TNCCS_20_H_ @}*/
index 03795a947eb18e8e39845cf9480c114777d255b4..0fbb2f67ef48cf4d6459a1a0a15201ba3729a39f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Andreas Steffen
+ * Copyright (C) 2011-2013 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -31,6 +31,16 @@ struct private_tnccs_dynamic_t {
         */
        tls_t public;
 
+       /**
+        * Server identity
+        */
+       identification_t *server;
+
+       /**
+        * Client identity
+        */
+       identification_t *peer;
+
        /**
         * Detected TNC IF-TNCCS stack
         */
@@ -76,7 +86,8 @@ METHOD(tls_t, process, status_t,
                type = determine_tnccs_protocol(*(char*)buf);
                DBG1(DBG_TNC, "%N protocol detected dynamically",
                                           tnccs_type_names, type);
-               this->tls = (tls_t*)tnc->tnccs->create_instance(tnc->tnccs, type, TRUE);
+               this->tls = (tls_t*)tnc->tnccs->create_instance(tnc->tnccs, type, TRUE,
+                                                                                                       this->server, this->peer);
                if (!this->tls)
                {
                        DBG1(DBG_TNC, "N% protocol not supported", tnccs_type_names, type);
@@ -120,13 +131,16 @@ METHOD(tls_t, destroy, void,
        private_tnccs_dynamic_t *this)
 {
        DESTROY_IF(this->tls);
+       this->server->destroy(this->server);
+       this->peer->destroy(this->peer);
        free(this);
 }
 
 /**
  * See header
  */
-tls_t *tnccs_dynamic_create(bool is_server)
+tls_t *tnccs_dynamic_create(bool is_server, identification_t *server,
+                                                       identification_t *peer)
 {
        private_tnccs_dynamic_t *this;
 
@@ -140,6 +154,8 @@ tls_t *tnccs_dynamic_create(bool is_server)
                        .get_eap_msk = _get_eap_msk,
                        .destroy = _destroy,
                },
+               .server = server->clone(server),
+               .peer = peer->clone(peer),
        );
 
        return &this->public;
index 42410b17f83e869b67266bed7f6572fff67660b9..383ebfcfa7ef2dee8799d67457c4244e1c1dd627 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Andreas Steffen
+ * Copyright (C) 2011-2013 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
 /**
  * Create an instance of a dynamic TNC IF-TNCCS protocol handler.
  *
- * @param is_server                    TRUE to act as TNC Server, FALSE for TNC Client
- * @return                                     dynamic TNC IF-TNCCS protocol stack
+ * @param is_server            TRUE to act as TNC Server, FALSE for TNC Client
+ * @param server               Server identity
+ * @param peer                 Client identity
+ * @return                             dynamic TNC IF-TNCCS protocol stack
  */
-tls_t *tnccs_dynamic_create(bool is_server);
+tls_t *tnccs_dynamic_create(bool is_server, identification_t *server,
+                                                       identification_t *peer);
 
 #endif /** TNCCS_DYNAMIC_H_ @}*/
index c3020d7c3588a3823fd59d782985cc0f86892f3e..530562e7f46844d85c40ad03e43f1ce248a47393 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2011 Andreas Steffen
+ * Copyright (C) 2010-2013 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -54,9 +54,13 @@ extern enum_name_t *tnccs_type_names;
  * Constructor definition for a pluggable TNCCS protocol implementation.
  *
  * @param is_server            TRUE if TNC Server, FALSE if TNC Client
+ * @param server               Server identity
+ * @param peer                 Client identity
  * @return                             implementation of the tnccs_t interface
  */
-typedef tnccs_t *(*tnccs_constructor_t)(bool is_server);
+typedef tnccs_t *(*tnccs_constructor_t)(bool is_server,
+                                                                               identification_t *server,
+                                                                               identification_t *peer);
 
 /**
  * Callback function adding a message to a TNCCS batch
index cbf2dc0e93f903ba7a32d90ceac3447e9d80af02..812f40a29333d5d820eabb8d9700e7304c357b32 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Andreas Steffen
+ * Copyright (C) 2010-2013 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -56,10 +56,13 @@ struct tnccs_manager_t {
         *
         * @param type            type of the TNCCS protocol
         * @param is_server       TRUE if TNC Server, FALSE if TNC Client
+        * @param server          Server identity
+        * @param peer            Client identity
         * @return                        TNCCS protocol instance, NULL if no constructor found
         */
        tnccs_t* (*create_instance)(tnccs_manager_t *this, tnccs_type_t type,
-                                                               bool is_server);
+                                                               bool is_server, identification_t *server,
+                                                               identification_t *peer);
 
        /**
         * Create a TNCCS connection and assign a unique connection ID as well a