diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2012-02-05 22:23:45 +0100 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2012-02-05 22:23:45 +0100 |
commit | a74fab640aebe20b168a0eaa6b4b52401e87b06c (patch) | |
tree | c4ea345daddb65fb7631ee275a813f0d7b19a09f /src | |
parent | 32aee74c730e9757157e502a815d3d7334c54aea (diff) | |
download | strongswan-a74fab640aebe20b168a0eaa6b4b52401e87b06c.tar.bz2 strongswan-a74fab640aebe20b168a0eaa6b4b52401e87b06c.tar.xz |
ipsec attest adds and deletes key/component pairs
Diffstat (limited to 'src')
-rw-r--r-- | src/libpts/plugins/imv_attestation/attest_db.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/libpts/plugins/imv_attestation/attest_db.c b/src/libpts/plugins/imv_attestation/attest_db.c index eef97bf76..0357e39d3 100644 --- a/src/libpts/plugins/imv_attestation/attest_db.c +++ b/src/libpts/plugins/imv_attestation/attest_db.c @@ -1045,7 +1045,18 @@ METHOD(attest_db_t, list_measurements, void, METHOD(attest_db_t, add, bool, private_attest_db_t *this) { - return FALSE; + bool success = FALSE; + + if (this->kid && this->cid) + { + success = this->db->execute(this->db, NULL, + "INSERT INTO key_component (key, component) VALUES (?, ?)", + DB_UINT, this->kid, DB_UINT, this->cid) == 1; + + printf("key/component pair (%d/%d) %sinserted into database\n", + this->kid, this->cid, success ? "" : "could not be "); + } + return success; } METHOD(attest_db_t, delete, bool, @@ -1059,10 +1070,16 @@ METHOD(attest_db_t, delete, bool, return FALSE; } - if (this->kid && this->did) + if (this->kid && this->cid) { - printf("deletion of key/component entries not supported yet\n"); - return FALSE; + success = this->db->execute(this->db, NULL, + "DELETE FROM key_component " + "WHERE key = ? AND component = ?", + DB_UINT, this->kid, DB_UINT, this->cid) > 0; + + printf("key/component pair (%d/%d) %sdeleted from database\n", + this->kid, this->cid, success ? "" : "could not be "); + return success; } if (this->cid) |