1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

2006-05-19 Marcus Brinkmann <marcus@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.
This commit is contained in:
Marcus Brinkmann 2006-05-22 14:35:04 +00:00
parent 61756ae3a7
commit 11544e7184
4 changed files with 22 additions and 7 deletions

View File

@ -1,3 +1,14 @@
2006-05-19 Marcus Brinkmann <marcus@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@g10code.com> 2006-03-21 Werner Koch <wk@g10code.com>
* certchain.c (get_regtp_ca_info): New. * certchain.c (get_regtp_ca_info): New.

View File

@ -124,7 +124,7 @@ delete_one (CTRL ctrl, const char *username)
goto leave; goto leave;
} }
rc = keydb_delete (kh); rc = keydb_delete (kh, duplicates ? 0 : 1);
if (rc) if (rc)
goto leave; goto leave;
if (opt.verbose) if (opt.verbose)

View File

@ -696,9 +696,8 @@ keydb_insert_cert (KEYDB_HANDLE hd, ksba_cert_t cert)
else else
return gpg_error (GPG_ERR_GENERAL); return gpg_error (GPG_ERR_GENERAL);
rc = lock_all (hd); if (!hd->locked)
if (rc) return gpg_error (GPG_ERR_NOT_LOCKED);
return rc;
gpgsm_get_fingerprint (cert, GCRY_MD_SHA1, digest, NULL); /* kludge*/ gpgsm_get_fingerprint (cert, GCRY_MD_SHA1, digest, NULL); /* kludge*/
@ -759,7 +758,7 @@ keydb_update_cert (KEYDB_HANDLE hd, ksba_cert_t cert)
* The current keyblock or cert will be deleted. * The current keyblock or cert will be deleted.
*/ */
int int
keydb_delete (KEYDB_HANDLE hd) keydb_delete (KEYDB_HANDLE hd, int unlock)
{ {
int rc = -1; int rc = -1;
@ -785,7 +784,8 @@ keydb_delete (KEYDB_HANDLE hd)
break; break;
} }
unlock_all (hd); if (unlock)
unlock_all (hd);
return rc; return rc;
} }
@ -1337,6 +1337,10 @@ keydb_store_cert (ksba_cert_t cert, int ephemeral, int *existed)
if (ephemeral) if (ephemeral)
keydb_set_ephemeral (kh, 1); keydb_set_ephemeral (kh, 1);
rc = lock_all (kh);
if (rc)
return rc;
rc = keydb_search_fpr (kh, fpr); rc = keydb_search_fpr (kh, fpr);
if (rc != -1) if (rc != -1)
{ {

View File

@ -53,7 +53,7 @@ int keydb_get_cert (KEYDB_HANDLE hd, ksba_cert_t *r_cert);
int keydb_insert_cert (KEYDB_HANDLE hd, ksba_cert_t cert); int keydb_insert_cert (KEYDB_HANDLE hd, ksba_cert_t cert);
int keydb_update_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); int keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved);
void keydb_rebuild_caches (void); void keydb_rebuild_caches (void);