[svn] GnuPG - r4137 - branches/GNUPG-1-9-BRANCH/sm

svn author marcus cvs at cvs.gnupg.org
Mon May 22 16:35:18 CEST 2006


Author: marcus
Date: 2006-05-22 16:35:04 +0200 (Mon, 22 May 2006)
New Revision: 4137

Modified:
   branches/GNUPG-1-9-BRANCH/sm/ChangeLog
   branches/GNUPG-1-9-BRANCH/sm/delete.c
   branches/GNUPG-1-9-BRANCH/sm/keydb.c
   branches/GNUPG-1-9-BRANCH/sm/keydb.h
Log:
2006-05-19  Marcus Brinkmann  <marcus at g10code.de>

	* keydb.c (keydb_insert_cert): Do not lock here, but only check if
	it is locked.
	(keydb_store_cert): Lock here.

	* keydb.h (keydb_delete): Accept new argument UNLOCK.
	* keydb.c (keydb_delete): Likewise.  Only unlock if this is set.
	* delete.c (delete_one): Add new argument to invocation of
	keydb_delete.


Modified: branches/GNUPG-1-9-BRANCH/sm/ChangeLog
===================================================================
--- branches/GNUPG-1-9-BRANCH/sm/ChangeLog	2006-05-17 08:42:12 UTC (rev 4136)
+++ branches/GNUPG-1-9-BRANCH/sm/ChangeLog	2006-05-22 14:35:04 UTC (rev 4137)
@@ -1,3 +1,14 @@
+2006-05-19  Marcus Brinkmann  <marcus at g10code.de>
+
+	* keydb.c (keydb_insert_cert): Do not lock here, but only check if
+	it is locked.
+	(keydb_store_cert): Lock here.
+
+	* keydb.h (keydb_delete): Accept new argument UNLOCK.
+	* keydb.c (keydb_delete): Likewise.  Only unlock if this is set.
+	* delete.c (delete_one): Add new argument to invocation of
+	keydb_delete.
+	
 2006-03-21  Werner Koch  <wk at g10code.com>
 
 	* certchain.c (get_regtp_ca_info): New.

Modified: branches/GNUPG-1-9-BRANCH/sm/delete.c
===================================================================
--- branches/GNUPG-1-9-BRANCH/sm/delete.c	2006-05-17 08:42:12 UTC (rev 4136)
+++ branches/GNUPG-1-9-BRANCH/sm/delete.c	2006-05-22 14:35:04 UTC (rev 4137)
@@ -124,7 +124,7 @@
           goto leave;
         }
       
-      rc = keydb_delete (kh);
+      rc = keydb_delete (kh, duplicates ? 0 : 1);
       if (rc) 
         goto leave;
       if (opt.verbose)

Modified: branches/GNUPG-1-9-BRANCH/sm/keydb.c
===================================================================
--- branches/GNUPG-1-9-BRANCH/sm/keydb.c	2006-05-17 08:42:12 UTC (rev 4136)
+++ branches/GNUPG-1-9-BRANCH/sm/keydb.c	2006-05-22 14:35:04 UTC (rev 4137)
@@ -696,9 +696,8 @@
   else
     return gpg_error (GPG_ERR_GENERAL);
 
-  rc = lock_all (hd);
-  if (rc)
-    return rc;
+  if (!hd->locked)
+    return gpg_error (GPG_ERR_NOT_LOCKED);
 
   gpgsm_get_fingerprint (cert, GCRY_MD_SHA1, digest, NULL); /* kludge*/
 
@@ -759,7 +758,7 @@
  * The current keyblock or cert will be deleted.
  */
 int
-keydb_delete (KEYDB_HANDLE hd)
+keydb_delete (KEYDB_HANDLE hd, int unlock)
 {
   int rc = -1;
   
@@ -785,7 +784,8 @@
       break;
     }
 
-  unlock_all (hd);
+  if (unlock)
+    unlock_all (hd);
   return rc;
 }
 
@@ -1337,6 +1337,10 @@
   if (ephemeral)
     keydb_set_ephemeral (kh, 1);
   
+  rc = lock_all (kh);
+  if (rc)
+    return rc;
+
   rc = keydb_search_fpr (kh, fpr);
   if (rc != -1)
     {

Modified: branches/GNUPG-1-9-BRANCH/sm/keydb.h
===================================================================
--- branches/GNUPG-1-9-BRANCH/sm/keydb.h	2006-05-17 08:42:12 UTC (rev 4136)
+++ branches/GNUPG-1-9-BRANCH/sm/keydb.h	2006-05-22 14:35:04 UTC (rev 4137)
@@ -53,7 +53,7 @@
 int keydb_insert_cert (KEYDB_HANDLE hd, ksba_cert_t cert);
 int keydb_update_cert (KEYDB_HANDLE hd, ksba_cert_t cert);
 
-int keydb_delete (KEYDB_HANDLE hd);
+int keydb_delete (KEYDB_HANDLE hd, int unlock);
 
 int keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved);
 void keydb_rebuild_caches (void);




More information about the Gnupg-commits mailing list