summaryrefslogtreecommitdiff
path: root/lib/softoken/sftkdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/softoken/sftkdb.c')
-rw-r--r--lib/softoken/sftkdb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/softoken/sftkdb.c b/lib/softoken/sftkdb.c
index 52e516117..4be6e5dff 100644
--- a/lib/softoken/sftkdb.c
+++ b/lib/softoken/sftkdb.c
@@ -2311,6 +2311,13 @@ loser:
crv = (*handle->update->sdb_GetMetaData)(handle->update, "password",
&item1, &item2);
if (crv != CKR_OK) {
+ /* if we get here, neither the source, nor the target has been initialized
+ * with a password entry. Create a metadata table now so that we don't
+ * mistake this for a partially updated database */
+ item1.data[0] = 0;
+ item2.data[0] = 0;
+ item1.len = item2.len = 1;
+ crv = (*handle->db->sdb_PutMetaData)(handle->db, "empty", &item1, &item2);
goto done;
}
crv = (*handle->db->sdb_PutMetaData)(handle->db, "password", &item1,