|
|
b31f4f |
diff --git a/lib/softoken/sdb.c b/lib/softoken/sdb.c
|
|
|
b31f4f |
--- a/lib/softoken/sdb.c
|
|
|
b31f4f |
+++ b/lib/softoken/sdb.c
|
|
|
b31f4f |
@@ -1519,16 +1519,18 @@ sdb_Begin(SDB *sdb)
|
|
|
b31f4f |
|
|
|
b31f4f |
sqlerr = sqlite3_prepare_v2(sqlDB, BEGIN_CMD, -1, &stmt, NULL);
|
|
|
b31f4f |
|
|
|
b31f4f |
do {
|
|
|
b31f4f |
sqlerr = sqlite3_step(stmt);
|
|
|
b31f4f |
if (sqlerr == SQLITE_BUSY) {
|
|
|
b31f4f |
PR_Sleep(SDB_BUSY_RETRY_TIME);
|
|
|
b31f4f |
}
|
|
|
b31f4f |
+ /* don't retry BEGIN transaction*/
|
|
|
b31f4f |
+ retry = 0;
|
|
|
b31f4f |
} while (!sdb_done(sqlerr, &retry));
|
|
|
b31f4f |
|
|
|
b31f4f |
if (stmt) {
|
|
|
b31f4f |
sqlite3_reset(stmt);
|
|
|
b31f4f |
sqlite3_finalize(stmt);
|
|
|
b31f4f |
}
|
|
|
b31f4f |
|
|
|
b31f4f |
loser:
|
|
|
b31f4f |
diff --git a/lib/softoken/sftkdb.c b/lib/softoken/sftkdb.c
|
|
|
b31f4f |
--- a/lib/softoken/sftkdb.c
|
|
|
b31f4f |
+++ b/lib/softoken/sftkdb.c
|
|
|
b31f4f |
@@ -1521,17 +1521,17 @@ sftkdb_DestroyObject(SFTKDBHandle *handl
|
|
|
b31f4f |
if (handle == NULL) {
|
|
|
b31f4f |
return CKR_TOKEN_WRITE_PROTECTED;
|
|
|
b31f4f |
}
|
|
|
b31f4f |
db = SFTK_GET_SDB(handle);
|
|
|
b31f4f |
objectID &= SFTK_OBJ_ID_MASK;
|
|
|
b31f4f |
|
|
|
b31f4f |
crv = (*db->sdb_Begin)(db);
|
|
|
b31f4f |
if (crv != CKR_OK) {
|
|
|
b31f4f |
- goto loser;
|
|
|
b31f4f |
+ return crv;
|
|
|
b31f4f |
}
|
|
|
b31f4f |
crv = (*db->sdb_DestroyObject)(db, objectID);
|
|
|
b31f4f |
if (crv != CKR_OK) {
|
|
|
b31f4f |
goto loser;
|
|
|
b31f4f |
}
|
|
|
b31f4f |
/* if the database supports meta data, delete any old signatures
|
|
|
b31f4f |
* that we may have added */
|
|
|
b31f4f |
if ((db->sdb_flags & SDB_HAS_META) == SDB_HAS_META) {
|
|
|
b31f4f |
@@ -2456,17 +2456,17 @@ sftkdb_Update(SFTKDBHandle *handle, SECI
|
|
|
b31f4f |
return CKR_OK;
|
|
|
b31f4f |
}
|
|
|
b31f4f |
/*
|
|
|
b31f4f |
* put the whole update under a transaction. This allows us to handle
|
|
|
b31f4f |
* any possible race conditions between with the updateID check.
|
|
|
b31f4f |
*/
|
|
|
b31f4f |
crv = (*handle->db->sdb_Begin)(handle->db);
|
|
|
b31f4f |
if (crv != CKR_OK) {
|
|
|
b31f4f |
- goto loser;
|
|
|
b31f4f |
+ return crv;
|
|
|
b31f4f |
}
|
|
|
b31f4f |
inTransaction = PR_TRUE;
|
|
|
b31f4f |
|
|
|
b31f4f |
/* some one else has already updated this db */
|
|
|
b31f4f |
if (sftkdb_hasUpdate(sftkdb_TypeString(handle),
|
|
|
b31f4f |
handle->db, handle->updateID)) {
|
|
|
b31f4f |
crv = CKR_OK;
|
|
|
b31f4f |
goto done;
|