aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/attr_sql
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-11-04 15:38:07 +0100
committerMartin Willi <martin@revosec.ch>2015-02-20 13:34:56 +0100
commitbc9ded9dbf39d064c3ff2239d9904566ff5888d6 (patch)
tree32004452b8ebec1d5706d84b7c1a701566ecf7e1 /src/libcharon/plugins/attr_sql
parenta12f357b40c75987965ee0ea9ff4f8ad5573fc5a (diff)
downloadstrongswan-bc9ded9dbf39d064c3ff2239d9904566ff5888d6.tar.bz2
strongswan-bc9ded9dbf39d064c3ff2239d9904566ff5888d6.tar.xz
attribute-provider: Pass full IKE_SA to provider backends
Diffstat (limited to 'src/libcharon/plugins/attr_sql')
-rw-r--r--src/libcharon/plugins/attr_sql/sql_attribute.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/libcharon/plugins/attr_sql/sql_attribute.c b/src/libcharon/plugins/attr_sql/sql_attribute.c
index d527c3fba..fc9fc3717 100644
--- a/src/libcharon/plugins/attr_sql/sql_attribute.c
+++ b/src/libcharon/plugins/attr_sql/sql_attribute.c
@@ -46,11 +46,14 @@ struct private_sql_attribute_t {
/**
* lookup/insert an identity
*/
-static u_int get_identity(private_sql_attribute_t *this, identification_t *id)
+static u_int get_identity(private_sql_attribute_t *this, ike_sa_t *ike_sa)
{
+ identification_t *id;
enumerator_t *e;
u_int row;
+ id = ike_sa->get_other_eap_id(ike_sa);
+
this->db->transaction(this->db, TRUE);
/* look for peer identity in the identities table */
e = this->db->query(this->db,
@@ -243,7 +246,7 @@ static host_t* get_lease(private_sql_attribute_t *this, char *name,
}
METHOD(attribute_provider_t, acquire_address, host_t*,
- private_sql_attribute_t *this, linked_list_t *pools, identification_t *id,
+ private_sql_attribute_t *this, linked_list_t *pools, ike_sa_t *ike_sa,
host_t *requested)
{
enumerator_t *enumerator;
@@ -252,7 +255,7 @@ METHOD(attribute_provider_t, acquire_address, host_t*,
char *name;
int family;
- identity = get_identity(this, id);
+ identity = get_identity(this, ike_sa);
if (identity)
{
family = requested->get_family(requested);
@@ -296,7 +299,7 @@ METHOD(attribute_provider_t, acquire_address, host_t*,
METHOD(attribute_provider_t, release_address, bool,
private_sql_attribute_t *this, linked_list_t *pools, host_t *address,
- identification_t *id)
+ ike_sa_t *ike_sa)
{
enumerator_t *enumerator;
u_int pool, timeout;
@@ -338,7 +341,7 @@ METHOD(attribute_provider_t, release_address, bool,
}
METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
- private_sql_attribute_t *this, linked_list_t *pools, identification_t *id,
+ private_sql_attribute_t *this, linked_list_t *pools, ike_sa_t *ike_sa,
linked_list_t *vips)
{
enumerator_t *attr_enumerator = NULL;
@@ -350,9 +353,9 @@ METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
char *name;
/* in a first step check for attributes that match name and id */
- if (id)
+ if (ike_sa)
{
- u_int identity = get_identity(this, id);
+ u_int identity = get_identity(this, ike_sa);
pool_enumerator = pools->create_enumerator(pools);
while (pool_enumerator->enumerate(pool_enumerator, &name))