sm: Add arg ctrl to keydb_new.

* sm/keydb.c (keydb_new): Add arg and change all callers.
--

This will be used later.
This commit is contained in:
Werner Koch 2020-09-02 17:27:30 +02:00
parent 90d0072165
commit a7d006293e
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
13 changed files with 24 additions and 22 deletions

View File

@ -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)

View File

@ -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"));

View File

@ -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

View File

@ -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"));

View File

@ -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");

View File

@ -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"));

View File

@ -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");

View File

@ -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);;

View File

@ -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");

View File

@ -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);

View File

@ -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");

View File

@ -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"));

View File

@ -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"));