implemented deletion of product_file database entries

This commit is contained in:
Andreas Steffen
2012-08-07 15:06:12 +02:00
parent 9c2f08860d
commit fa1baac315
+13 -15
View File
@@ -1273,19 +1273,6 @@ METHOD(attest_db_t, delete, bool,
{ {
bool success; bool success;
/* delete key/component pair */
if (this->kid && this->cid)
{
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;
}
/* delete a file measurement hash for a given product */ /* delete a file measurement hash for a given product */
if (this->algo && this->pid && this->fid) if (this->algo && this->pid && this->fid)
{ {
@@ -1305,12 +1292,23 @@ METHOD(attest_db_t, delete, bool,
return success; return success;
} }
/* delete product/file entries */
if (this->pid && (this->fid || this->did)) if (this->pid && (this->fid || this->did))
{ {
printf("deletion of product/file entries not supported yet\n"); success = this->db->execute(this->db, NULL,
return FALSE; "DELETE FROM product_file "
"WHERE product = ? AND file = ?",
DB_UINT, this->pid,
DB_UINT, this->fid ? this->fid : this->did) > 0;
printf("product/file pair (%d/%d) %sdeleted from database\n",
this->pid, this->fid ? this->fid : this->did,
success ? "" : "could not be ");
return success;
} }
/* delete key/component pair */
if (this->kid && this->cid) if (this->kid && this->cid)
{ {
success = this->db->execute(this->db, NULL, success = this->db->execute(this->db, NULL,