gpg: Do not call an extra get_validity if no-show-uid-validity is used.

* g10/mainproc.c (check_sig_and_print): Do not call the informational
get_validity if we are not going to use it.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-10-26 20:36:16 +01:00
parent 91015d021b
commit a6c2c09843
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 25 additions and 6 deletions

View File

@ -1838,7 +1838,8 @@ check_sig_and_print (CTX c, kbnode_t node)
snprintf (keyid_str, sizeof keyid_str, "%08lX%08lX [uncertain] ", snprintf (keyid_str, sizeof keyid_str, "%08lX%08lX [uncertain] ",
(ulong)sig->keyid[0], (ulong)sig->keyid[1]); (ulong)sig->keyid[0], (ulong)sig->keyid[1]);
/* Find and print the primary user ID. */ /* Find and print the primary user ID along with the
"Good|Expired|Bad signature" line. */
for (un=keyblock; un; un = un->next) for (un=keyblock; un; un = un->next)
{ {
int valid; int valid;
@ -1866,8 +1867,13 @@ check_sig_and_print (CTX c, kbnode_t node)
/* Since this is just informational, don't actually ask the /* Since this is just informational, don't actually ask the
user to update any trust information. (Note: we register user to update any trust information. (Note: we register
the signature later.) */ the signature later.) Because print_good_bad_signature
valid = get_validity (pk, un->pkt->pkt.user_id, NULL, 0); does not print a LF we need to compute the validity
before calling that function. */
if ((opt.verify_options & VERIFY_SHOW_UID_VALIDITY))
valid = get_validity (pk, un->pkt->pkt.user_id, NULL, 0);
else
valid = 0; /* Not used. */
keyid_str[17] = 0; /* cut off the "[uncertain]" part */ keyid_str[17] = 0; /* cut off the "[uncertain]" part */
@ -1878,11 +1884,17 @@ check_sig_and_print (CTX c, kbnode_t node)
else else
log_printf ("\n"); log_printf ("\n");
/* Get a string description of the algo for informational
output we want to print later. It is convenient to do it
here because we already have the right public key. */
pubkey_string (pk, pkstrbuf, sizeof pkstrbuf); pubkey_string (pk, pkstrbuf, sizeof pkstrbuf);
count++; count++;
} }
if (!count) /* Just in case that we have no valid textual userid */ /* In case we did not found a valid valid textual userid above
we print the first user id packet or a "[?]" instead along
with the "Good|Expired|Bad signature" line. */
if (!count)
{ {
/* Try for an invalid textual userid */ /* Try for an invalid textual userid */
for (un=keyblock; un; un = un->next) for (un=keyblock; un; un = un->next)
@ -1927,11 +1939,12 @@ check_sig_and_print (CTX c, kbnode_t node)
|| un->pkt->pkt.user_id->is_expired) || un->pkt->pkt.user_id->is_expired)
&& !(opt.verify_options & VERIFY_SHOW_UNUSABLE_UIDS)) && !(opt.verify_options & VERIFY_SHOW_UNUSABLE_UIDS))
continue; continue;
/* Only skip textual primaries */ /* Skip textual primary user ids which we printed above. */
if (un->pkt->pkt.user_id->is_primary if (un->pkt->pkt.user_id->is_primary
&& !un->pkt->pkt.user_id->attrib_data ) && !un->pkt->pkt.user_id->attrib_data )
continue; continue;
/* If this user id has attribute data, print that. */
if (un->pkt->pkt.user_id->attrib_data) if (un->pkt->pkt.user_id->attrib_data)
{ {
dump_attribs (un->pkt->pkt.user_id, pk); dump_attribs (un->pkt->pkt.user_id, pk);
@ -1969,6 +1982,7 @@ check_sig_and_print (CTX c, kbnode_t node)
} }
release_kbnode( keyblock ); release_kbnode( keyblock );
/* For good signatures print notation data. */
if (!rc) if (!rc)
{ {
if ((opt.verify_options & VERIFY_SHOW_POLICY_URLS)) if ((opt.verify_options & VERIFY_SHOW_POLICY_URLS))
@ -1990,9 +2004,9 @@ check_sig_and_print (CTX c, kbnode_t node)
show_notation (sig, 0, 2, 0); show_notation (sig, 0, 2, 0);
} }
/* For good signatures print the VALIDSIG status line. */
if (!rc && is_status_enabled ()) if (!rc && is_status_enabled ())
{ {
/* Print a status response with the fingerprint. */
PKT_public_key *vpk = xmalloc_clear (sizeof *vpk); PKT_public_key *vpk = xmalloc_clear (sizeof *vpk);
if (!get_pubkey (vpk, sig->keyid)) if (!get_pubkey (vpk, sig->keyid))
@ -2040,6 +2054,9 @@ check_sig_and_print (CTX c, kbnode_t node)
free_public_key (vpk); free_public_key (vpk);
} }
/* For good signatures compute and print the trust information.
Note that in the Tofu trust model this may ask the user on
how to resolve a conflict. */
if (!rc) if (!rc)
{ {
if ((opt.verify_options & VERIFY_PKA_LOOKUPS)) if ((opt.verify_options & VERIFY_PKA_LOOKUPS))
@ -2047,6 +2064,7 @@ check_sig_and_print (CTX c, kbnode_t node)
rc = check_signatures_trust (sig); rc = check_signatures_trust (sig);
} }
/* Print extra information about the signature. */
if (sig->flags.expired) if (sig->flags.expired)
{ {
log_info (_("Signature expired %s\n"), asctimestamp(sig->expiredate)); log_info (_("Signature expired %s\n"), asctimestamp(sig->expiredate));
@ -2063,6 +2081,7 @@ check_sig_and_print (CTX c, kbnode_t node)
*pkstrbuf?_(", key algorithm "):"", *pkstrbuf?_(", key algorithm "):"",
pkstrbuf); pkstrbuf);
/* Print final warnings. */
if (!rc && !c->signed_data.used) if (!rc && !c->signed_data.used)
{ {
/* Signature is basically good but we test whether the /* Signature is basically good but we test whether the