diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2012-10-08 18:56:22 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2012-10-08 18:56:22 +0200 |
commit | f4263eaef6666ddd21f0209539b534a8c6fde01e (patch) | |
tree | d6e6742d03f8b4e430c142c02970e669dea74ef5 /src/libpts | |
parent | 7f5675c8e5a1131b7ac12c0724c374f4def9a0f7 (diff) | |
download | strongswan-f4263eaef6666ddd21f0209539b534a8c6fde01e.tar.bz2 strongswan-f4263eaef6666ddd21f0209539b534a8c6fde01e.tar.xz |
list multiple files with a given basename but different path names
Diffstat (limited to 'src/libpts')
-rw-r--r-- | src/libpts/plugins/imv_attestation/attest_db.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/libpts/plugins/imv_attestation/attest_db.c b/src/libpts/plugins/imv_attestation/attest_db.c index 55afbf701..26301c4f4 100644 --- a/src/libpts/plugins/imv_attestation/attest_db.c +++ b/src/libpts/plugins/imv_attestation/attest_db.c @@ -858,7 +858,7 @@ METHOD(attest_db_t, list_hashes, void, dir = strdup(""); - if (this->pid && this->fid) + if (this->pid && this->fid & this->did) { e = this->db->query(this->db, "SELECT hash FROM file_hashes " @@ -885,6 +885,32 @@ METHOD(attest_db_t, list_hashes, void, (count == 1) ? "" : "s", this->product); } } + else if (this->pid && this->fid) + { + e = this->db->query(this->db, + "SELECT f.path, fh.hash FROM file_hashes AS fh " + "JOIN files AS f ON f.id = fh.directory " + "WHERE algo = ? AND file = ? AND product = ?", + DB_INT, this->algo, DB_INT, this->fid, DB_INT, this->pid, + DB_TEXT, DB_BLOB); + if (e) + { + free(dir); + while (e->enumerate(e, &dir, &hash)) + { + printf("%4d: %s%s%s\n", this->fid, dir, + slash(dir, this->file) ? "/" : "", this->file); + printf(" %#B\n", &hash); + count++; + } + e->destroy(e); + + printf("%d %N value%s found for product '%s'\n", count, + pts_meas_algorithm_names, this->algo, + (count == 1) ? "" : "s", this->product); + dir = NULL; + } + } else if (this->pid) { e = this->db->query(this->db, |