aboutsummaryrefslogtreecommitdiffstats
path: root/src/libpts
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2012-07-19 13:48:32 +0200
committerAndreas Steffen <andreas.steffen@strongswan.org>2012-07-19 13:49:35 +0200
commit214097e804c82833ccedee133a212662a14563dd (patch)
tree6ed7e300711bfe583989d7af6c95b14f07bfdbab /src/libpts
parent96e8ba0f78629c6f3093f9b796c2297aa80bfcee (diff)
downloadstrongswan-214097e804c82833ccedee133a212662a14563dd.tar.bz2
strongswan-214097e804c82833ccedee133a212662a14563dd.tar.xz
queries with relative filenames might return multiple results
Diffstat (limited to 'src/libpts')
-rw-r--r--src/libpts/pts/pts_database.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/libpts/pts/pts_database.c b/src/libpts/pts/pts_database.c
index 7d6e6abab..946f37e1e 100644
--- a/src/libpts/pts/pts_database.c
+++ b/src/libpts/pts/pts_database.c
@@ -127,7 +127,7 @@ METHOD(pts_database_t, check_file_measurement, status_t,
{
enumerator_t *e;
chunk_t hash;
- status_t status;
+ status_t status = NOT_FOUND;
e = this->db->query(this->db,
"SELECT fh.hash FROM file_hashes AS fh "
@@ -139,15 +139,19 @@ METHOD(pts_database_t, check_file_measurement, status_t,
{
return FAILED;
}
- if (e->enumerate(e, &hash))
- {
- status = chunk_equals(measurement, hash) ?
- SUCCESS : VERIFY_ERROR;
- }
- else
+ while (e->enumerate(e, &hash))
{
- status = NOT_FOUND;
- }
+ /* with relative filenames there might be multiple entries */
+ if (chunk_equals(measurement, hash))
+ {
+ status = SUCCESS;
+ break;
+ }
+ else
+ {
+ status = VERIFY_ERROR;
+ }
+ }
e->destroy(e);
return status;