summaryrefslogtreecommitdiffstats
path: root/sm
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2020-09-02 17:27:30 +0200
committerWerner Koch <wk@gnupg.org>2020-09-03 13:49:20 +0200
commita7d006293ec84532cc1972cd2f990198eadf1a1a (patch)
treee24545df6161f24cde5cbe4ca1e1153a5785b221 /sm
parentscd: Add handling of "Algorithm Information" DO. (diff)
downloadgnupg2-a7d006293ec84532cc1972cd2f990198eadf1a1a.tar.xz
gnupg2-a7d006293ec84532cc1972cd2f990198eadf1a1a.zip
sm: Add arg ctrl to keydb_new.
* sm/keydb.c (keydb_new): Add arg and change all callers. -- This will be used later.
Diffstat (limited to 'sm')
-rw-r--r--sm/call-dirmngr.c2
-rw-r--r--sm/certchain.c6
-rw-r--r--sm/certlist.c4
-rw-r--r--sm/decrypt.c2
-rw-r--r--sm/delete.c2
-rw-r--r--sm/encrypt.c2
-rw-r--r--sm/export.c4
-rw-r--r--sm/import.c2
-rw-r--r--sm/keydb.c10
-rw-r--r--sm/keydb.h2
-rw-r--r--sm/keylist.c2
-rw-r--r--sm/sign.c6
-rw-r--r--sm/verify.c2
13 files changed, 24 insertions, 22 deletions
diff --git a/sm/call-dirmngr.c b/sm/call-dirmngr.c
index 7619f60df..8222d999c 100644
--- a/sm/call-dirmngr.c
+++ b/sm/call-dirmngr.c
@@ -547,7 +547,7 @@ gpgsm_dirmngr_isvalid (ctrl_t ctrl,
from the dirmngr. Try our own cert store now. */
KEYDB_HANDLE kh;
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
rc = gpg_error (GPG_ERR_ENOMEM);
if (!rc)
diff --git a/sm/certchain.c b/sm/certchain.c
index d92b2e833..53bdea612 100644
--- a/sm/certchain.c
+++ b/sm/certchain.c
@@ -1033,7 +1033,7 @@ gpgsm_walk_cert_chain (ctrl_t ctrl, ksba_cert_t start, ksba_cert_t *r_next)
int rc = 0;
char *issuer = NULL;
char *subject = NULL;
- KEYDB_HANDLE kh = keydb_new ();
+ KEYDB_HANDLE kh = keydb_new (ctrl);
*r_next = NULL;
if (!kh)
@@ -1548,7 +1548,7 @@ do_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime_arg,
return 0;
}
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
{
log_error (_("failed to allocate keyDB handle\n"));
@@ -2186,7 +2186,7 @@ gpgsm_basic_cert_check (ctrl_t ctrl, ksba_cert_t cert)
return 0;
}
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
{
log_error (_("failed to allocate keyDB handle\n"));
diff --git a/sm/certlist.c b/sm/certlist.c
index 95666dc8f..d18fce62c 100644
--- a/sm/certlist.c
+++ b/sm/certlist.c
@@ -323,7 +323,7 @@ gpgsm_add_to_certlist (ctrl_t ctrl, const char *name, int secret,
rc = classify_user_id (name, &desc, 0);
if (!rc)
{
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
rc = gpg_error (GPG_ERR_ENOMEM);
else
@@ -499,7 +499,7 @@ gpgsm_find_cert (ctrl_t ctrl,
rc = classify_user_id (name, &desc, 0);
if (!rc)
{
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
rc = gpg_error (GPG_ERR_ENOMEM);
else
diff --git a/sm/decrypt.c b/sm/decrypt.c
index af9c2d684..2d846335e 100644
--- a/sm/decrypt.c
+++ b/sm/decrypt.c
@@ -637,7 +637,7 @@ gpgsm_decrypt (ctrl_t ctrl, int in_fd, estream_t out_fp)
audit_set_type (ctrl->audit, AUDIT_TYPE_DECRYPT);
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
{
log_error (_("failed to allocate keyDB handle\n"));
diff --git a/sm/delete.c b/sm/delete.c
index 9ba3fa137..00840a4de 100644
--- a/sm/delete.c
+++ b/sm/delete.c
@@ -53,7 +53,7 @@ delete_one (ctrl_t ctrl, const char *username)
goto leave;
}
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
{
log_error ("keydb_new failed\n");
diff --git a/sm/encrypt.c b/sm/encrypt.c
index 449b3b4f8..34a5e878b 100644
--- a/sm/encrypt.c
+++ b/sm/encrypt.c
@@ -614,7 +614,7 @@ gpgsm_encrypt (ctrl_t ctrl, certlist_t recplist, int data_fd, estream_t out_fp)
count++;
audit_log_i (ctrl->audit, AUDIT_GOT_RECIPIENTS, count);
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
{
log_error (_("failed to allocate keyDB handle\n"));
diff --git a/sm/export.c b/sm/export.c
index 115d79b9e..bba24f0b1 100644
--- a/sm/export.c
+++ b/sm/export.c
@@ -149,7 +149,7 @@ gpgsm_export (ctrl_t ctrl, strlist_t names, estream_t stream)
goto leave;
}
- hd = keydb_new ();
+ hd = keydb_new (ctrl);
if (!hd)
{
log_error ("keydb_new failed\n");
@@ -338,7 +338,7 @@ gpgsm_p12_export (ctrl_t ctrl, const char *name, estream_t stream, int rawmode)
void *data;
size_t datalen;
- hd = keydb_new ();
+ hd = keydb_new (ctrl);
if (!hd)
{
log_error ("keydb_new failed\n");
diff --git a/sm/import.c b/sm/import.c
index a4dd671f8..988d127d1 100644
--- a/sm/import.c
+++ b/sm/import.c
@@ -407,7 +407,7 @@ reimport_one (ctrl_t ctrl, struct stats_s *stats, int in_fd)
ksba_cert_t cert = NULL;
unsigned int flags;
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
{
err = gpg_error (GPG_ERR_ENOMEM);;
diff --git a/sm/keydb.c b/sm/keydb.c
index 5c7ff6fce..ede65f458 100644
--- a/sm/keydb.c
+++ b/sm/keydb.c
@@ -398,11 +398,13 @@ keydb_add_resource (ctrl_t ctrl, const char *url, int force, int *auto_created)
KEYDB_HANDLE
-keydb_new (void)
+keydb_new (ctrl_t ctrl)
{
KEYDB_HANDLE hd;
int i, j;
+ (void)ctrl;
+
if (DBG_CLOCK)
log_clock ("%s: enter\n", __func__);
@@ -1305,7 +1307,7 @@ keydb_store_cert (ctrl_t ctrl, ksba_cert_t cert, int ephemeral, int *existed)
return gpg_error (GPG_ERR_GENERAL);
}
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
{
log_error (_("failed to allocate keyDB handle\n"));
@@ -1391,7 +1393,7 @@ keydb_set_cert_flags (ctrl_t ctrl, ksba_cert_t cert, int ephemeral,
return gpg_error (GPG_ERR_GENERAL);
}
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
{
log_error (_("failed to allocate keyDB handle\n"));
@@ -1462,7 +1464,7 @@ keydb_clear_some_cert_flags (ctrl_t ctrl, strlist_t names)
(void)ctrl;
- hd = keydb_new ();
+ hd = keydb_new (ctrl);
if (!hd)
{
log_error ("keydb_new failed\n");
diff --git a/sm/keydb.h b/sm/keydb.h
index 1ab94a2c2..2d766ad9d 100644
--- a/sm/keydb.h
+++ b/sm/keydb.h
@@ -33,7 +33,7 @@ typedef struct keydb_handle *KEYDB_HANDLE;
/*-- keydb.c --*/
gpg_error_t keydb_add_resource (ctrl_t ctrl, const char *url,
int force, int *auto_created);
-KEYDB_HANDLE keydb_new (void);
+KEYDB_HANDLE keydb_new (ctrl_t ctrl);
void keydb_release (KEYDB_HANDLE hd);
int keydb_set_ephemeral (KEYDB_HANDLE hd, int yes);
const char *keydb_get_resource_name (KEYDB_HANDLE hd);
diff --git a/sm/keylist.c b/sm/keylist.c
index fdfee6772..3b0c74f55 100644
--- a/sm/keylist.c
+++ b/sm/keylist.c
@@ -1448,7 +1448,7 @@ list_internal_keys (ctrl_t ctrl, strlist_t names, estream_t fp,
int have_secret;
int want_ephemeral = ctrl->with_ephemeral_keys;
- hd = keydb_new ();
+ hd = keydb_new (ctrl);
if (!hd)
{
log_error ("keydb_new failed\n");
diff --git a/sm/sign.c b/sm/sign.c
index 8a65d58c1..08e30ebd6 100644
--- a/sm/sign.c
+++ b/sm/sign.c
@@ -140,7 +140,7 @@ gpgsm_get_default_cert (ctrl_t ctrl, ksba_cert_t *r_cert)
int rc;
char *p;
- hd = keydb_new ();
+ hd = keydb_new (ctrl);
if (!hd)
return gpg_error (GPG_ERR_GENERAL);
rc = keydb_search_first (ctrl, hd);
@@ -217,7 +217,7 @@ get_default_signer (ctrl_t ctrl)
return NULL;
}
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
return NULL;
@@ -422,7 +422,7 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist,
audit_set_type (ctrl->audit, AUDIT_TYPE_SIGN);
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
{
log_error (_("failed to allocate keyDB handle\n"));
diff --git a/sm/verify.c b/sm/verify.c
index e95734770..1575a1eb2 100644
--- a/sm/verify.c
+++ b/sm/verify.c
@@ -111,7 +111,7 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, estream_t out_fp)
audit_set_type (ctrl->audit, AUDIT_TYPE_VERIFY);
- kh = keydb_new ();
+ kh = keydb_new (ctrl);
if (!kh)
{
log_error (_("failed to allocate keyDB handle\n"));