aboutsummaryrefslogtreecommitdiffstats
path: root/sm/keydb.c
diff options
context:
space:
mode:
Diffstat (limited to 'sm/keydb.c')
-rw-r--r--sm/keydb.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sm/keydb.c b/sm/keydb.c
index 52f40f1ad..fec44153c 100644
--- a/sm/keydb.c
+++ b/sm/keydb.c
@@ -1196,15 +1196,20 @@ keydb_classify_name (const char *name, KEYDB_SEARCH_DESC *desc)
}
-/* Store the certificate in the key Db but make sure that it does not
- already exists. We do this simply by comparing the fingerprint */
+/* Store the certificate in the key DB but make sure that it does not
+ already exists. We do this simply by comparing the fingerprint.
+ If EXISTED is not NULL it will be set to true if the certificate
+ was already in the DB. */
int
-keydb_store_cert (KsbaCert cert, int ephemeral)
+keydb_store_cert (KsbaCert cert, int ephemeral, int *existed)
{
KEYDB_HANDLE kh;
int rc;
unsigned char fpr[20];
+ if (existed)
+ *existed = 0;
+
if (!gpgsm_get_fingerprint (cert, 0, fpr, NULL))
{
log_error (_("failed to get the fingerprint\n"));
@@ -1226,7 +1231,11 @@ keydb_store_cert (KsbaCert cert, int ephemeral)
{
keydb_release (kh);
if (!rc)
- return 0; /* okay */
+ {
+ if (existed)
+ *existed = 1;
+ return 0; /* okay */
+ }
log_error (_("problem looking for existing certificate: %s\n"),
gnupg_strerror (rc));
return rc;
@@ -1252,3 +1261,4 @@ keydb_store_cert (KsbaCert cert, int ephemeral)
}
+