mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Pass CTRL object down to the trust functions
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
fd973ee1c1
commit
027c4e5552
16 changed files with 180 additions and 152 deletions
30
g10/trust.c
30
g10/trust.c
|
@ -131,7 +131,7 @@ string_to_trust_value (const char *str)
|
|||
|
||||
|
||||
const char *
|
||||
uid_trust_string_fixed (PKT_public_key *key, PKT_user_id *uid)
|
||||
uid_trust_string_fixed (ctrl_t ctrl, PKT_public_key *key, PKT_user_id *uid)
|
||||
{
|
||||
if (!key && !uid)
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ uid_trust_string_fixed (PKT_public_key *key, PKT_user_id *uid)
|
|||
return _("[ expired]");
|
||||
else if(key)
|
||||
{
|
||||
switch (get_validity (key, uid, NULL, 0) & TRUST_MASK)
|
||||
switch (get_validity (ctrl, key, uid, NULL, 0) & TRUST_MASK)
|
||||
{
|
||||
case TRUST_UNKNOWN: return _("[ unknown]");
|
||||
case TRUST_EXPIRED: return _("[ expired]");
|
||||
|
@ -275,19 +275,23 @@ revalidation_mark (void)
|
|||
|
||||
|
||||
void
|
||||
check_trustdb_stale (void)
|
||||
check_trustdb_stale (ctrl_t ctrl)
|
||||
{
|
||||
#ifndef NO_TRUST_MODELS
|
||||
tdb_check_trustdb_stale ();
|
||||
tdb_check_trustdb_stale (ctrl);
|
||||
#else
|
||||
(void)ctrl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
check_or_update_trustdb (void)
|
||||
check_or_update_trustdb (ctrl_t ctrl)
|
||||
{
|
||||
#ifndef NO_TRUST_MODELS
|
||||
tdb_check_or_update ();
|
||||
tdb_check_or_update (ctrl);
|
||||
#else
|
||||
(void)ctrl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -298,8 +302,8 @@ check_or_update_trustdb (void)
|
|||
* otherwise, a reasonable value for the entire key is returned.
|
||||
*/
|
||||
unsigned int
|
||||
get_validity (PKT_public_key *pk, PKT_user_id *uid, PKT_signature *sig,
|
||||
int may_ask)
|
||||
get_validity (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid,
|
||||
PKT_signature *sig, int may_ask)
|
||||
{
|
||||
int rc;
|
||||
unsigned int validity;
|
||||
|
@ -331,7 +335,7 @@ get_validity (PKT_public_key *pk, PKT_user_id *uid, PKT_signature *sig,
|
|||
#ifdef NO_TRUST_MODELS
|
||||
validity = TRUST_UNKNOWN;
|
||||
#else
|
||||
validity = tdb_get_validity_core (pk, uid, main_pk, sig, may_ask);
|
||||
validity = tdb_get_validity_core (ctrl, pk, uid, main_pk, sig, may_ask);
|
||||
#endif
|
||||
|
||||
leave:
|
||||
|
@ -353,14 +357,14 @@ get_validity (PKT_public_key *pk, PKT_user_id *uid, PKT_signature *sig,
|
|||
|
||||
|
||||
int
|
||||
get_validity_info (PKT_public_key *pk, PKT_user_id *uid)
|
||||
get_validity_info (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid)
|
||||
{
|
||||
int trustlevel;
|
||||
|
||||
if (!pk)
|
||||
return '?'; /* Just in case a NULL PK is passed. */
|
||||
|
||||
trustlevel = get_validity (pk, uid, NULL, 0);
|
||||
trustlevel = get_validity (ctrl, pk, uid, NULL, 0);
|
||||
if ((trustlevel & TRUST_FLAG_REVOKED))
|
||||
return 'r';
|
||||
return trust_letter (trustlevel);
|
||||
|
@ -368,14 +372,14 @@ get_validity_info (PKT_public_key *pk, PKT_user_id *uid)
|
|||
|
||||
|
||||
const char *
|
||||
get_validity_string (PKT_public_key *pk, PKT_user_id *uid)
|
||||
get_validity_string (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid)
|
||||
{
|
||||
int trustlevel;
|
||||
|
||||
if (!pk)
|
||||
return "err"; /* Just in case a NULL PK is passed. */
|
||||
|
||||
trustlevel = get_validity (pk, uid, NULL, 0);
|
||||
trustlevel = get_validity (ctrl, pk, uid, NULL, 0);
|
||||
if ((trustlevel & TRUST_FLAG_REVOKED))
|
||||
return _("revoked");
|
||||
return trust_value_to_string (trustlevel);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue