aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-06-04 07:23:27 +0000
committerWerner Koch <[email protected]>2019-06-04 07:24:03 +0000
commit9bf650db022b6b65bbfa74c311cdc3e6b73d3b44 (patch)
tree08e820887a3539c4affd8273672dc956479cfb41
parentg10: Block signals in g10_exit. (diff)
downloadgnupg-9bf650db022b6b65bbfa74c311cdc3e6b73d3b44.tar.gz
gnupg-9bf650db022b6b65bbfa74c311cdc3e6b73d3b44.zip
sm: Print a better diagnostic for encryption certificate selection.
* sm/certlist.c (gpgsm_add_to_certlist): Add diagnostic and fold two similar branches. -- Without this patch gpgsm printed: gpgsm[23045]: DBG: chan_6 <- RECIPIENT [email protected] gpgsm[23045]: certificate is not usable for encryption gpgsm[23045]: certificate is good with this patch a gpgsm[23045]: looking for another certificate is inserted into the log. Signed-off-by: Werner Koch <[email protected]>
-rw-r--r--sm/certlist.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sm/certlist.c b/sm/certlist.c
index 0847c169b..b3d113bfd 100644
--- a/sm/certlist.c
+++ b/sm/certlist.c
@@ -352,19 +352,14 @@ gpgsm_add_to_certlist (ctrl_t ctrl, const char *name, int secret,
{
/* There might be another certificate with the
correct usage, so we try again */
- if (!wrong_usage)
- { /* save the first match */
- wrong_usage = rc;
- ksba_cert_release (cert);
- cert = NULL;
- goto get_next;
- }
- else if (same_subject_issuer (first_subject, first_issuer,
- cert))
+ if (!wrong_usage
+ || same_subject_issuer (first_subject, first_issuer,cert))
{
- wrong_usage = rc;
+ if (!wrong_usage)
+ wrong_usage = rc; /* save error of the first match */
ksba_cert_release (cert);
cert = NULL;
+ log_info (_("looking for another certificate\n"));
goto get_next;
}
else