summaryrefslogtreecommitdiff
path: root/src/libcharon/plugins/sql
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@corsac.net>2017-09-01 17:21:25 +0200
committerYves-Alexis Perez <corsac@corsac.net>2017-09-01 17:21:25 +0200
commit11d6b62db969bdd808d0f56706cb18f113927a31 (patch)
tree8aa7d8fb611c3da6a3523cb78a082f62ffd0dac8 /src/libcharon/plugins/sql
parentbba25e2ff6c4a193acb54560ea4417537bd2954e (diff)
downloadvyos-strongswan-11d6b62db969bdd808d0f56706cb18f113927a31.tar.gz
vyos-strongswan-11d6b62db969bdd808d0f56706cb18f113927a31.zip
New upstream version 5.6.0
Diffstat (limited to 'src/libcharon/plugins/sql')
-rw-r--r--src/libcharon/plugins/sql/Makefile.in8
-rw-r--r--src/libcharon/plugins/sql/sql_config.c93
-rw-r--r--src/libcharon/plugins/sql/sql_cred.c10
3 files changed, 60 insertions, 51 deletions
diff --git a/src/libcharon/plugins/sql/Makefile.in b/src/libcharon/plugins/sql/Makefile.in
index 5c146190d..e0b813d6b 100644
--- a/src/libcharon/plugins/sql/Makefile.in
+++ b/src/libcharon/plugins/sql/Makefile.in
@@ -311,8 +311,6 @@ RANLIB = @RANLIB@
RTLIB = @RTLIB@
RUBY = @RUBY@
RUBYGEMDIR = @RUBYGEMDIR@
-RUBYINCLUDE = @RUBYINCLUDE@
-RUBYLIB = @RUBYLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -413,6 +411,8 @@ random_device = @random_device@
resolv_conf = @resolv_conf@
routing_table = @routing_table@
routing_table_prio = @routing_table_prio@
+ruby_CFLAGS = @ruby_CFLAGS@
+ruby_LIBS = @ruby_LIBS@
runstatedir = @runstatedir@
s_plugins = @s_plugins@
sbindir = @sbindir@
@@ -441,6 +441,10 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
tss2_CFLAGS = @tss2_CFLAGS@
tss2_LIBS = @tss2_LIBS@
+tss2_socket_CFLAGS = @tss2_socket_CFLAGS@
+tss2_socket_LIBS = @tss2_socket_LIBS@
+tss2_tabrmd_CFLAGS = @tss2_tabrmd_CFLAGS@
+tss2_tabrmd_LIBS = @tss2_tabrmd_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libcharon/plugins/sql/sql_config.c b/src/libcharon/plugins/sql/sql_config.c
index 00ed693eb..86728515f 100644
--- a/src/libcharon/plugins/sql/sql_config.c
+++ b/src/libcharon/plugins/sql/sql_config.c
@@ -102,10 +102,11 @@ static void add_traffic_selectors(private_sql_config_t *this,
bool local;
e = this->db->query(this->db,
- "SELECT kind, type, protocol, "
- "start_addr, end_addr, start_port, end_port "
- "FROM traffic_selectors JOIN child_config_traffic_selector "
- "ON id = traffic_selector WHERE child_cfg = ?",
+ "SELECT ct.kind, t.type, t.protocol, "
+ "t.start_addr, t.end_addr, t.start_port, t.end_port "
+ "FROM traffic_selectors AS t "
+ "JOIN child_config_traffic_selector AS ct "
+ "ON t.id = ct.traffic_selector WHERE ct.child_cfg = ?",
DB_INT, id,
DB_INT, DB_INT, DB_INT,
DB_BLOB, DB_BLOB, DB_INT, DB_INT);
@@ -131,9 +132,9 @@ static void add_esp_proposals(private_sql_config_t *this,
bool use_default = TRUE;
e = this->db->query(this->db,
- "SELECT proposal "
- "FROM proposals JOIN child_config_proposal ON id = prop "
- "WHERE child_cfg = ? ORDER BY prio",
+ "SELECT p.proposal "
+ "FROM proposals AS p JOIN child_config_proposal AS cp "
+ "ON p.id = cp.prop WHERE cp.child_cfg = ? ORDER BY cp.prio",
DB_INT, id, DB_TEXT);
if (e)
{
@@ -202,10 +203,11 @@ static void add_child_cfgs(private_sql_config_t *this, peer_cfg_t *peer, int id)
child_cfg_t *child_cfg;
e = this->db->query(this->db,
- "SELECT id, name, lifetime, rekeytime, jitter, updown, hostaccess, "
- "mode, start_action, dpd_action, close_action, ipcomp, reqid "
- "FROM child_configs JOIN peer_config_child_config ON id = child_cfg "
- "WHERE peer_cfg = ?",
+ "SELECT c.id, c.name, c.lifetime, c.rekeytime, c.jitter, c.updown, "
+ "c.hostaccess, c.mode, c.start_action, c.dpd_action, "
+ "c.close_action, c.ipcomp, c.reqid "
+ "FROM child_configs AS c JOIN peer_config_child_config AS pc "
+ "ON c.id = pc.child_cfg WHERE pc.peer_cfg = ?",
DB_INT, id,
DB_INT, DB_TEXT, DB_INT, DB_INT, DB_INT, DB_TEXT, DB_INT,
DB_INT, DB_INT, DB_INT, DB_INT, DB_INT, DB_INT);
@@ -231,9 +233,10 @@ static void add_ike_proposals(private_sql_config_t *this,
bool use_default = TRUE;
e = this->db->query(this->db,
- "SELECT proposal "
- "FROM proposals JOIN ike_config_proposal ON id = prop "
- "WHERE ike_cfg = ? ORDER BY prio",
+ "SELECT p.proposal "
+ "FROM proposals AS p "
+ "JOIN ike_config_proposal AS ip ON p.id = ip.prop "
+ "WHERE ip.ike_cfg = ? ORDER BY ip.prio",
DB_INT, id, DB_TEXT);
if (e)
{
@@ -288,8 +291,8 @@ static ike_cfg_t* get_ike_cfg_by_id(private_sql_config_t *this, int id)
ike_cfg_t *ike_cfg = NULL;
e = this->db->query(this->db,
- "SELECT id, certreq, force_encap, local, remote "
- "FROM ike_configs WHERE id = ?",
+ "SELECT c.id, c.certreq, c.force_encap, c.local, c.remote "
+ "FROM ike_configs AS c WHERE c.id = ?",
DB_INT, id,
DB_INT, DB_INT, DB_INT, DB_TEXT, DB_TEXT);
if (e)
@@ -310,16 +313,16 @@ static peer_cfg_t *get_peer_cfg_by_id(private_sql_config_t *this, int id)
peer_cfg_t *peer_cfg = NULL;
e = this->db->query(this->db,
- "SELECT c.id, name, ike_cfg, l.type, l.data, r.type, r.data, "
- "cert_policy, uniqueid, auth_method, eap_type, eap_vendor, "
- "keyingtries, rekeytime, reauthtime, jitter, overtime, mobike, "
- "dpd_delay, virtual, pool, "
- "mediation, mediated_by, COALESCE(p.type, 0), p.data "
+ "SELECT c.id, c.name, c.ike_cfg, l.type, l.data, r.type, r.data, "
+ "c.cert_policy, c.uniqueid, c.auth_method, c.eap_type, "
+ "c.eap_vendor, c.keyingtries, c.rekeytime, c.reauthtime, c.jitter, "
+ "c.overtime, c.mobike, c.dpd_delay, c.virtual, c.pool, "
+ "c.mediation, c.mediated_by, COALESCE(p.type, 0), p.data "
"FROM peer_configs AS c "
- "JOIN identities AS l ON local_id = l.id "
- "JOIN identities AS r ON remote_id = r.id "
- "LEFT JOIN identities AS p ON peer_id = p.id "
- "WHERE id = ?",
+ "JOIN identities AS l ON c.local_id = l.id "
+ "JOIN identities AS r ON c.remote_id = r.id "
+ "LEFT JOIN identities AS p ON c.peer_id = p.id "
+ "WHERE c.id = ?",
DB_INT, id,
DB_INT, DB_TEXT, DB_INT, DB_INT, DB_BLOB, DB_INT, DB_BLOB,
DB_INT, DB_INT, DB_INT, DB_INT, DB_INT,
@@ -465,16 +468,16 @@ METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
peer_cfg_t *peer_cfg = NULL;
e = this->db->query(this->db,
- "SELECT c.id, name, ike_cfg, l.type, l.data, r.type, r.data, "
- "cert_policy, uniqueid, auth_method, eap_type, eap_vendor, "
- "keyingtries, rekeytime, reauthtime, jitter, overtime, mobike, "
- "dpd_delay, virtual, pool, "
- "mediation, mediated_by, COALESCE(p.type, 0), p.data "
+ "SELECT c.id, c.name, c.ike_cfg, l.type, l.data, r.type, r.data, "
+ "c.cert_policy, c.uniqueid, c.auth_method, c.eap_type, "
+ "c.eap_vendor, c.keyingtries, c.rekeytime, c.reauthtime, c.jitter, "
+ "c.overtime, c.mobike, c.dpd_delay, c.virtual, c.pool, "
+ "c.mediation, c.mediated_by, COALESCE(p.type, 0), p.data "
"FROM peer_configs AS c "
- "JOIN identities AS l ON local_id = l.id "
- "JOIN identities AS r ON remote_id = r.id "
- "LEFT JOIN identities AS p ON peer_id = p.id "
- "WHERE ike_version = ? AND name = ?",
+ "JOIN identities AS l ON c.local_id = l.id "
+ "JOIN identities AS r ON c.remote_id = r.id "
+ "LEFT JOIN identities AS p ON c.peer_id = p.id "
+ "WHERE c.ike_version = ? AND c.name = ?",
DB_INT, 2, DB_TEXT, name,
DB_INT, DB_TEXT, DB_INT, DB_INT, DB_BLOB, DB_INT, DB_BLOB,
DB_INT, DB_INT, DB_INT, DB_INT, DB_INT,
@@ -544,8 +547,8 @@ METHOD(backend_t, create_ike_cfg_enumerator, enumerator_t*,
.other = other,
);
e->inner = this->db->query(this->db,
- "SELECT id, certreq, force_encap, local, remote "
- "FROM ike_configs",
+ "SELECT c.id, c.certreq, c.force_encap, "
+ "c.local, c.remote FROM ike_configs AS c",
DB_INT, DB_INT, DB_INT, DB_TEXT, DB_TEXT);
if (!e->inner)
{
@@ -613,16 +616,16 @@ METHOD(backend_t, create_peer_cfg_enumerator, enumerator_t*,
/* TODO: only get configs whose IDs match exactly or contain wildcards */
e->inner = this->db->query(this->db,
- "SELECT c.id, name, ike_cfg, l.type, l.data, r.type, r.data, "
- "cert_policy, uniqueid, auth_method, eap_type, eap_vendor, "
- "keyingtries, rekeytime, reauthtime, jitter, overtime, mobike, "
- "dpd_delay, virtual, pool, "
- "mediation, mediated_by, COALESCE(p.type, 0), p.data "
+ "SELECT c.id, c.name, c.ike_cfg, l.type, l.data, r.type, r.data, "
+ "c.cert_policy, c.uniqueid, c.auth_method, c.eap_type, "
+ "c.eap_vendor, c.keyingtries, c.rekeytime, c.reauthtime, c.jitter, "
+ "c.overtime, c.mobike, c.dpd_delay, c.virtual, c.pool, "
+ "c.mediation, c.mediated_by, COALESCE(p.type, 0), p.data "
"FROM peer_configs AS c "
- "JOIN identities AS l ON local_id = l.id "
- "JOIN identities AS r ON remote_id = r.id "
- "LEFT JOIN identities AS p ON peer_id = p.id "
- "WHERE ike_version = ?",
+ "JOIN identities AS l ON c.local_id = l.id "
+ "JOIN identities AS r ON c.remote_id = r.id "
+ "LEFT JOIN identities AS p ON c.peer_id = p.id "
+ "WHERE c.ike_version = ?",
DB_INT, 2,
DB_INT, DB_TEXT, DB_INT, DB_INT, DB_BLOB, DB_INT, DB_BLOB,
DB_INT, DB_INT, DB_INT, DB_INT, DB_INT,
diff --git a/src/libcharon/plugins/sql/sql_cred.c b/src/libcharon/plugins/sql/sql_cred.c
index 3317de6c8..9ba0bf1c9 100644
--- a/src/libcharon/plugins/sql/sql_cred.c
+++ b/src/libcharon/plugins/sql/sql_cred.c
@@ -110,7 +110,8 @@ METHOD(credential_set_t, create_private_enumerator, enumerator_t*,
else
{
e->inner = this->db->query(this->db,
- "SELECT type, data FROM private_keys WHERE (? OR type = ?)",
+ "SELECT p.type, p.data FROM private_keys AS p "
+ "WHERE (? OR p.type = ?)",
DB_INT, type == KEY_ANY, DB_INT, type,
DB_INT, DB_BLOB);
}
@@ -197,8 +198,8 @@ METHOD(credential_set_t, create_cert_enumerator, enumerator_t*,
else
{
e->inner = this->db->query(this->db,
- "SELECT type, data FROM certificates WHERE "
- "(? OR type = ?) AND (? OR keytype = ?)",
+ "SELECT c.type, c.data FROM certificates AS c WHERE "
+ "(? OR c.type = ?) AND (? OR c.keytype = ?)",
DB_INT, cert == CERT_ANY, DB_INT, cert,
DB_INT, key == KEY_ANY, DB_INT, key,
DB_INT, DB_BLOB);
@@ -286,7 +287,8 @@ METHOD(credential_set_t, create_shared_enumerator, enumerator_t*,
if (!me && !other)
{
e->inner = this->db->query(this->db,
- "SELECT type, data FROM shared_secrets WHERE (? OR type = ?)",
+ "SELECT s.type, s.data FROM shared_secrets AS s "
+ "WHERE (? OR s.type = ?)",
DB_INT, type == SHARED_ANY, DB_INT, type,
DB_INT, DB_BLOB);
}