aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2013-03-11 08:54:02 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2013-03-11 08:54:02 +0100
commita498c7a9c38af173b7ff85901bab5b19bf8a3fec (patch)
tree6bd74507e20b4bc2c6250327477a37b6e067db71
parent2b1e2434e422b1701184b594bc386b1532da75af (diff)
downloadstrongswan-a498c7a9c38af173b7ff85901bab5b19bf8a3fec.tar.bz2
strongswan-a498c7a9c38af173b7ff85901bab5b19bf8a3fec.tar.xz
moved ar_id from imv_agent to imv_state
-rw-r--r--src/libimcv/imv/imv_agent.c21
-rw-r--r--src/libimcv/imv/imv_agent.h9
-rw-r--r--src/libimcv/imv/imv_state.h16
-rw-r--r--src/libimcv/plugins/imv_os/imv_os.c4
-rw-r--r--src/libimcv/plugins/imv_os/imv_os_state.c23
-rw-r--r--src/libimcv/plugins/imv_scanner/imv_scanner_state.c23
-rw-r--r--src/libimcv/plugins/imv_test/imv_test_state.c23
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation_state.c24
8 files changed, 112 insertions, 31 deletions
diff --git a/src/libimcv/imv/imv_agent.c b/src/libimcv/imv/imv_agent.c
index 2eec0ecde..8b4247e0f 100644
--- a/src/libimcv/imv/imv_agent.c
+++ b/src/libimcv/imv/imv_agent.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2012 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
@@ -73,11 +73,6 @@ struct private_imv_agent_t {
rwlock_t *connection_lock;
/**
- * Access Requestor ID
- */
- identification_t *ar_id;
-
- /**
* Inform a TNCS about the set of message types the IMV is able to receive
*
* @param imv_id IMV ID assigned by TNCS
@@ -449,6 +444,7 @@ METHOD(imv_agent_t, create_state, TNC_Result,
pen_type_t id_type, subject_type, auth_type;
int tcg_id_type, tcg_subject_type, tcg_auth_type;
chunk_t id_value;
+ identification_t *ar_id;
id_type_t ike_type;
id_type = tnc_id->get_identity_type(tnc_id);
@@ -492,10 +488,11 @@ METHOD(imv_agent_t, create_state, TNC_Result,
break;
}
- this->ar_id = identification_create_from_encoding(ike_type, id_value);
+ ar_id = identification_create_from_encoding(ike_type, id_value);
DBG2(DBG_IMV, " %N AR identity '%Y' authenticated by %N",
- TNC_Subject_names, tcg_subject_type, this->ar_id,
+ TNC_Subject_names, tcg_subject_type, ar_id,
TNC_Authentication_names, tcg_auth_type);
+ state->set_ar_id(state, ar_id);
}
enumerator->destroy(enumerator);
@@ -598,12 +595,6 @@ METHOD(imv_agent_t, get_id, TNC_IMVID,
return this->id;
}
-METHOD(imv_agent_t, get_ar_id, identification_t*,
- private_imv_agent_t *this)
-{
- return this->ar_id;
-}
-
METHOD(imv_agent_t, reserve_additional_ids, TNC_Result,
private_imv_agent_t *this, int count)
{
@@ -793,7 +784,6 @@ METHOD(imv_agent_t, destroy, void,
private_imv_agent_t *this)
{
DBG1(DBG_IMV, "IMV %u \"%s\" terminated", this->id, this->name);
- DESTROY_IF(this->ar_id);
this->additional_ids->destroy(this->additional_ids);
this->connections->destroy_offset(this->connections,
offsetof(imv_state_t, destroy));
@@ -828,7 +818,6 @@ imv_agent_t *imv_agent_create(const char *name,
.get_state = _get_state,
.get_name = _get_name,
.get_id = _get_id,
- .get_ar_id = _get_ar_id,
.reserve_additional_ids = _reserve_additional_ids,
.count_additional_ids = _count_additional_ids,
.create_id_enumerator = _create_id_enumerator,
diff --git a/src/libimcv/imv/imv_agent.h b/src/libimcv/imv/imv_agent.h
index 737caa173..6f3d2b4b7 100644
--- a/src/libimcv/imv/imv_agent.h
+++ b/src/libimcv/imv/imv_agent.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2012 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
@@ -152,13 +152,6 @@ struct imv_agent_t {
TNC_IMVID (*get_id)(imv_agent_t *this);
/**
- * Get Access Requestor ID
- *
- * return Access Requestor ID
- */
- identification_t* (*get_ar_id)(imv_agent_t *this);
-
- /**
* Reserve additional IMV IDs from TNCS
*
* @param count number of additional IMV IDs to be assigned
diff --git a/src/libimcv/imv/imv_state.h b/src/libimcv/imv/imv_state.h
index 0684690ca..5a818e662 100644
--- a/src/libimcv/imv/imv_state.h
+++ b/src/libimcv/imv/imv_state.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2012 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
@@ -78,6 +78,20 @@ struct imv_state_t {
u_int32_t (*get_max_msg_len)(imv_state_t *this);
/**
+ * Set Access Requestor ID
+ *
+ * @param ar_id Access Requestor ID (is not going to be cloned)
+ */
+ void (*set_ar_id)(imv_state_t *this, identification_t *ar_id);
+
+ /**
+ * Get Access Requestor ID
+ *
+ * @return Access Requestor ID
+ */
+ identification_t* (*get_ar_id)(imv_state_t *this);
+
+ /**
* Change the connection state
*
* @param new_state new connection state
diff --git a/src/libimcv/plugins/imv_os/imv_os.c b/src/libimcv/plugins/imv_os/imv_os.c
index 68b14abfb..e63fc73b1 100644
--- a/src/libimcv/plugins/imv_os/imv_os.c
+++ b/src/libimcv/plugins/imv_os/imv_os.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Andreas Steffen
+ * Copyright (C) 2012-2013 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -390,7 +390,7 @@ static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
device_id = os_state->get_device_id(os_state);
if (os_db && device_id)
{
- os_db->set_device_info(os_db, device_id, imv_os->get_ar_id(imv_os),
+ os_db->set_device_info(os_db, device_id, state->get_ar_id(state),
os_state->get_info(os_state, NULL, NULL, NULL),
count, count_update, count_blacklist, os_settings);
}
diff --git a/src/libimcv/plugins/imv_os/imv_os_state.c b/src/libimcv/plugins/imv_os/imv_os_state.c
index 00e0424fb..6a71a04aa 100644
--- a/src/libimcv/plugins/imv_os/imv_os_state.c
+++ b/src/libimcv/plugins/imv_os/imv_os_state.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Andreas Steffen
+ * Copyright (C) 2012-2013 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -62,6 +62,11 @@ struct private_imv_os_state_t {
u_int32_t max_msg_len;
/**
+ * Access Requestor ID
+ */
+ identification_t *ar_id;
+
+ /**
* IMV action recommendation
*/
TNC_IMV_Action_Recommendation rec;
@@ -319,6 +324,19 @@ METHOD(imv_state_t, get_max_msg_len, u_int32_t,
return this->max_msg_len;
}
+METHOD(imv_state_t, set_ar_id, void,
+ private_imv_os_state_t *this, identification_t *ar_id)
+{
+ /* no cloning, caller must not destroy object */
+ this->ar_id = ar_id;
+}
+
+METHOD(imv_state_t, get_ar_id, identification_t*,
+ private_imv_os_state_t *this)
+{
+ return this->ar_id;
+}
+
METHOD(imv_state_t, change_state, void,
private_imv_os_state_t *this, TNC_ConnectionState new_state)
{
@@ -435,6 +453,7 @@ METHOD(imv_state_t, get_remediation_instructions, bool,
METHOD(imv_state_t, destroy, void,
private_imv_os_state_t *this)
{
+ DESTROY_IF(this->ar_id);
DESTROY_IF(this->reason_string);
DESTROY_IF(this->remediation_string);
this->update_packages->destroy_function(this->update_packages, free);
@@ -603,6 +622,8 @@ imv_state_t *imv_os_state_create(TNC_ConnectionID connection_id)
.set_flags = _set_flags,
.set_max_msg_len = _set_max_msg_len,
.get_max_msg_len = _get_max_msg_len,
+ .set_ar_id = _set_ar_id,
+ .get_ar_id = _get_ar_id,
.change_state = _change_state,
.get_recommendation = _get_recommendation,
.set_recommendation = _set_recommendation,
diff --git a/src/libimcv/plugins/imv_scanner/imv_scanner_state.c b/src/libimcv/plugins/imv_scanner/imv_scanner_state.c
index 108e5ff6f..8821ed504 100644
--- a/src/libimcv/plugins/imv_scanner/imv_scanner_state.c
+++ b/src/libimcv/plugins/imv_scanner/imv_scanner_state.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2012 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
@@ -59,6 +59,11 @@ struct private_imv_scanner_state_t {
u_int32_t max_msg_len;
/**
+ * Access Requestor ID
+ */
+ identification_t *ar_id;
+
+ /**
* IMV action recommendation
*/
TNC_IMV_Action_Recommendation rec;
@@ -165,6 +170,19 @@ METHOD(imv_state_t, get_max_msg_len, u_int32_t,
return this->max_msg_len;
}
+METHOD(imv_state_t, set_ar_id, void,
+ private_imv_scanner_state_t *this, identification_t *ar_id)
+{
+ /* no cloning, caller must not destroy object */
+ this->ar_id = ar_id;
+}
+
+METHOD(imv_state_t, get_ar_id, identification_t*,
+ private_imv_scanner_state_t *this)
+{
+ return this->ar_id;
+}
+
METHOD(imv_state_t, change_state, void,
private_imv_scanner_state_t *this, TNC_ConnectionState new_state)
{
@@ -238,6 +256,7 @@ METHOD(imv_state_t, get_remediation_instructions, bool,
METHOD(imv_state_t, destroy, void,
private_imv_scanner_state_t *this)
{
+ DESTROY_IF(this->ar_id);
DESTROY_IF(this->reason_string);
DESTROY_IF(this->remediation_string);
this->violating_ports->destroy_function(this->violating_ports, free);
@@ -266,6 +285,8 @@ imv_state_t *imv_scanner_state_create(TNC_ConnectionID connection_id)
.set_flags = _set_flags,
.set_max_msg_len = _set_max_msg_len,
.get_max_msg_len = _get_max_msg_len,
+ .set_ar_id = _set_ar_id,
+ .get_ar_id = _get_ar_id,
.change_state = _change_state,
.get_recommendation = _get_recommendation,
.set_recommendation = _set_recommendation,
diff --git a/src/libimcv/plugins/imv_test/imv_test_state.c b/src/libimcv/plugins/imv_test/imv_test_state.c
index 9b9344bf6..385a37452 100644
--- a/src/libimcv/plugins/imv_test/imv_test_state.c
+++ b/src/libimcv/plugins/imv_test/imv_test_state.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2012 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
@@ -59,6 +59,11 @@ struct private_imv_test_state_t {
u_int32_t max_msg_len;
/**
+ * Access Requestor ID
+ */
+ identification_t *ar_id;
+
+ /**
* IMV action recommendation
*/
TNC_IMV_Action_Recommendation rec;
@@ -143,6 +148,19 @@ METHOD(imv_state_t, get_max_msg_len, u_int32_t,
return this->max_msg_len;
}
+METHOD(imv_state_t, set_ar_id, void,
+ private_imv_test_state_t *this, identification_t *ar_id)
+{
+ /* no cloning, caller must not destroy object */
+ this->ar_id = ar_id;
+}
+
+METHOD(imv_state_t, get_ar_id, identification_t*,
+ private_imv_test_state_t *this)
+{
+ return this->ar_id;
+}
+
METHOD(imv_state_t, change_state, void,
private_imv_test_state_t *this, TNC_ConnectionState new_state)
{
@@ -191,6 +209,7 @@ METHOD(imv_state_t, get_remediation_instructions, bool,
METHOD(imv_state_t, destroy, void,
private_imv_test_state_t *this)
{
+ DESTROY_IF(this->ar_id);
DESTROY_IF(this->reason_string);
this->imcs->destroy_function(this->imcs, free);
free(this);
@@ -277,6 +296,8 @@ imv_state_t *imv_test_state_create(TNC_ConnectionID connection_id)
.set_flags = _set_flags,
.set_max_msg_len = _set_max_msg_len,
.get_max_msg_len = _get_max_msg_len,
+ .set_ar_id = _set_ar_id,
+ .get_ar_id = _get_ar_id,
.change_state = _change_state,
.get_recommendation = _get_recommendation,
.set_recommendation = _set_recommendation,
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_state.c b/src/libpts/plugins/imv_attestation/imv_attestation_state.c
index 93da9aee5..9d95ac010 100644
--- a/src/libpts/plugins/imv_attestation/imv_attestation_state.c
+++ b/src/libpts/plugins/imv_attestation/imv_attestation_state.c
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
+ * Copyright (C) 2011-2012 Sansar Choinyambuu
+ * Copyright (C) 2011-2013 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -63,6 +64,11 @@ struct private_imv_attestation_state_t {
u_int32_t max_msg_len;
/**
+ * Access Requestor ID
+ */
+ identification_t *ar_id;
+
+ /**
* IMV Attestation handshake state
*/
imv_attestation_handshake_state_t handshake_state;
@@ -215,6 +221,19 @@ METHOD(imv_state_t, get_max_msg_len, u_int32_t,
return this->max_msg_len;
}
+METHOD(imv_state_t, set_ar_id, void,
+ private_imv_attestation_state_t *this, identification_t *ar_id)
+{
+ /* no cloning, caller must not destroy object */
+ this->ar_id = ar_id;
+}
+
+METHOD(imv_state_t, get_ar_id, identification_t*,
+ private_imv_attestation_state_t *this)
+{
+ return this->ar_id;
+}
+
METHOD(imv_state_t, change_state, void,
private_imv_attestation_state_t *this, TNC_ConnectionState new_state)
{
@@ -288,6 +307,7 @@ METHOD(imv_state_t, get_remediation_instructions, bool,
METHOD(imv_state_t, destroy, void,
private_imv_attestation_state_t *this)
{
+ DESTROY_IF(this->ar_id);
DESTROY_IF(this->reason_string);
this->file_meas_requests->destroy_function(this->file_meas_requests, free);
this->components->destroy_function(this->components, (void *)free_func_comp);
@@ -479,6 +499,8 @@ imv_state_t *imv_attestation_state_create(TNC_ConnectionID connection_id)
.set_flags = _set_flags,
.set_max_msg_len = _set_max_msg_len,
.get_max_msg_len = _get_max_msg_len,
+ .set_ar_id = _set_ar_id,
+ .get_ar_id = _get_ar_id,
.change_state = _change_state,
.get_recommendation = _get_recommendation,
.set_recommendation = _set_recommendation,