aboutsummaryrefslogtreecommitdiffstats
path: root/src/libpts
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2012-07-27 11:45:56 +0200
committerAndreas Steffen <andreas.steffen@strongswan.org>2012-07-27 11:47:22 +0200
commit9e99d2c37845e9120f7c611944eaeca397eed092 (patch)
tree5697de21bb134791f1fb71afb42ef37f8642caa9 /src/libpts
parent777bcdc0d5c96ee8036f2aa417fd455852f4ef8d (diff)
downloadstrongswan-9e99d2c37845e9120f7c611944eaeca397eed092.tar.bz2
strongswan-9e99d2c37845e9120f7c611944eaeca397eed092.tar.xz
with --relative --file do not insert absolute filenames into database
Diffstat (limited to 'src/libpts')
-rw-r--r--src/libpts/plugins/imv_attestation/attest_db.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libpts/plugins/imv_attestation/attest_db.c b/src/libpts/plugins/imv_attestation/attest_db.c
index 50641ee0d..1ce3cf8e2 100644
--- a/src/libpts/plugins/imv_attestation/attest_db.c
+++ b/src/libpts/plugins/imv_attestation/attest_db.c
@@ -349,6 +349,7 @@ METHOD(attest_db_t, set_file, bool,
private_attest_db_t *this, char *file, bool create)
{
enumerator_t *e;
+ char *filename;
if (this->file_set)
{
@@ -356,9 +357,10 @@ METHOD(attest_db_t, set_file, bool,
return FALSE;
}
this->file = strdup(file);
+ filename = this->relative ? basename(file) : file;
e = this->db->query(this->db, "SELECT id FROM files WHERE path = ?",
- DB_TEXT, file, DB_INT);
+ DB_TEXT, filename, DB_INT);
if (e)
{
if (e->enumerate(e, &this->fid))
@@ -381,9 +383,9 @@ METHOD(attest_db_t, set_file, bool,
/* Add a new database entry */
this->file_set = this->db->execute(this->db, &this->fid,
"INSERT INTO files (type, path) VALUES (0, ?)",
- DB_TEXT, file) == 1;
+ DB_TEXT, filename) == 1;
- printf("file '%s' %sinserted into database\n", file,
+ printf("file '%s' %sinserted into database\n", filename,
this->file_set ? "" : "could not be ");
return this->file_set;