sm: Do not print certain issuer not found diags in quiet mode.

* sm/certchain.c (find_up_dirmngr): Print one diagnostic only in
verbose mode.  Do not print issuer not found diags in quiet mode.
* sm/minip12.c (parse_bag_data): Add missing verbose condition.
--

GnuPG-bug-id: 4757
This commit is contained in:
Werner Koch 2021-02-25 09:16:18 +01:00
parent 473b83d1b9
commit a170f0e73f
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 28 additions and 21 deletions

View File

@ -815,7 +815,7 @@ find_up_dirmngr (ctrl_t ctrl, KEYDB_HANDLE kh,
if (opt.verbose)
log_info (_("number of matching certificates: %d\n"),
find_up_store_certs_parm.count);
if (rc && !opt.quiet)
if (rc && opt.verbose)
log_info (_("dirmngr cache-only key lookup failed: %s\n"),
gpg_strerror (rc));
return ((!rc && find_up_store_certs_parm.count)
@ -957,6 +957,8 @@ find_up (ctrl_t ctrl, KEYDB_HANDLE kh,
if (gpg_err_code (err) == GPG_ERR_NOT_FOUND && opt.quiet)
;
else if (gpg_err_code (err) == GPG_ERR_NOT_FOUND)
{
if (!opt.quiet)
{
log_info ("%sissuer certificate ", find_next?"next ":"");
if (keyid)
@ -975,6 +977,7 @@ find_up (ctrl_t ctrl, KEYDB_HANDLE kh,
}
log_printf ("not found using authorityKeyIdentifier\n");
}
}
else if (err)
log_error ("failed to find authorityKeyIdentifier: err=%d\n", err);
xfree (keyid);
@ -1803,7 +1806,7 @@ do_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime_arg,
if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
{
do_list (0, listmode, listfp, _("issuer certificate not found"));
if (!listmode)
if (!listmode && !opt.quiet)
{
log_info ("issuer certificate: #/");
gpgsm_dump_string (issuer);
@ -2231,11 +2234,14 @@ gpgsm_basic_cert_check (ctrl_t ctrl, ksba_cert_t cert)
if (rc)
{
if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
{
if (!opt.quiet)
{
log_info ("issuer certificate (#/");
gpgsm_dump_string (issuer);
log_printf (") not found\n");
}
}
else
log_error ("failed to find issuer's certificate: %s <%s>\n",
gpg_strerror (rc), gpg_strsource (rc));

View File

@ -1449,6 +1449,7 @@ parse_bag_data (const unsigned char *buffer, size_t length, int startoffset,
if (ti.class || ti.tag != TAG_OCTET_STRING || !ti.length )
goto bailout;
if (opt_verbose)
log_info ("%lu bytes of %s encrypted text\n",
ti.length, is_pbes2? "AES128":"3DES");