Blame SOURCES/nss-3.67-fix-sdb-timeout.patch

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