mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
* g10.c (main): New --gnupg option to disable the various --openpgp,
--pgpX, etc. options. This is the same as --no-XXXX for those options. * packet.h, getkey.c (skip_disabled), keylist.c (print_capabilities): New "pk_is_disabled" macro to retrieve the cached disabled value if available, and fill it in via cache_disabled_value if not available. * trustdb.h, gpgv.c (is_disabled), trustdb.c (is_disabled): Rename to cache_disabled_value. Cache the result of the check so we don't need to hit the trustdb more than once. * trustdb.c (get_validity): Cache the disabled value since we have it handy and it might be useful later.
This commit is contained in:
parent
66f51ba19f
commit
6957239566
8 changed files with 55 additions and 24 deletions
|
@ -745,12 +745,15 @@ clear_validity (PKT_public_key *pk)
|
|||
|
||||
/* Return true if key is disabled */
|
||||
int
|
||||
is_disabled(PKT_public_key *pk)
|
||||
cache_disabled_value(PKT_public_key *pk)
|
||||
{
|
||||
int rc;
|
||||
TRUSTREC trec;
|
||||
int disabled=0;
|
||||
|
||||
if(pk->is_disabled)
|
||||
return (pk->is_disabled==2);
|
||||
|
||||
init_trustdb();
|
||||
|
||||
rc = read_trust_record (pk, &trec);
|
||||
|
@ -765,6 +768,13 @@ is_disabled(PKT_public_key *pk)
|
|||
if(trec.r.trust.ownertrust & TRUST_FLAG_DISABLED)
|
||||
disabled=1;
|
||||
|
||||
/* Cache it for later so we don't need to look at the trustdb every
|
||||
time */
|
||||
if(disabled)
|
||||
pk->is_disabled=2;
|
||||
else
|
||||
pk->is_disabled=1;
|
||||
|
||||
leave:
|
||||
return disabled;
|
||||
}
|
||||
|
@ -875,7 +885,12 @@ get_validity (PKT_public_key *pk, PKT_user_id *uid)
|
|||
}
|
||||
|
||||
if ( (trec.r.trust.ownertrust & TRUST_FLAG_DISABLED) )
|
||||
validity |= TRUST_FLAG_DISABLED;
|
||||
{
|
||||
validity |= TRUST_FLAG_DISABLED;
|
||||
pk->is_disabled=2;
|
||||
}
|
||||
else
|
||||
pk->is_disabled=1;
|
||||
|
||||
leave:
|
||||
/* set some flags direct from the key */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue