mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-02 16:43:03 +01:00
* trustdb.c (get_validity_info, get_ownertrust_info, trust_letter):
Simplify by returning a ? for error directly. * keyedit.c (show_key_with_all_names): Use get_validity_string and get_ownertrust_string to show full word versions of trust (i.e. "full" instead of 'f'). * trustdb.h, trustdb.c (get_ownertrust_string, get_validity_string): Same as get_ownertrust_info, and get_validity_info, except returns a full string. * trustdb.c (get_ownertrust_with_min): New. Same as 'get_ownertrust' but takes the min_ownertrust value into account.
This commit is contained in:
parent
8b3b70499a
commit
7a5c4d215c
@ -1,3 +1,19 @@
|
||||
2003-01-11 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* trustdb.c (get_validity_info, get_ownertrust_info,
|
||||
trust_letter): Simplify by returning a ? for error directly.
|
||||
|
||||
* keyedit.c (show_key_with_all_names): Use get_validity_string and
|
||||
get_ownertrust_string to show full word versions of trust
|
||||
(i.e. "full" instead of 'f').
|
||||
|
||||
* trustdb.h, trustdb.c (get_ownertrust_string,
|
||||
get_validity_string): Same as get_ownertrust_info, and
|
||||
get_validity_info, except returns a full string.
|
||||
|
||||
* trustdb.c (get_ownertrust_with_min): New. Same as
|
||||
'get_ownertrust' but takes the min_ownertrust value into account.
|
||||
|
||||
2003-01-10 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* armor.c (armor_filter): Comment about PGP's end of line tab
|
||||
|
@ -1897,15 +1897,15 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
|
||||
if( node->pkt->pkttype == PKT_PUBLIC_KEY
|
||||
|| (with_subkeys && node->pkt->pkttype == PKT_PUBLIC_SUBKEY) ) {
|
||||
PKT_public_key *pk = node->pkt->pkt.public_key;
|
||||
int otrust=0, trust=0;
|
||||
const char *otrust="err",*trust="err";
|
||||
|
||||
if( node->pkt->pkttype == PKT_PUBLIC_KEY ) {
|
||||
/* do it here, so that debug messages don't clutter the
|
||||
* output */
|
||||
static int did_warn = 0;
|
||||
|
||||
trust = get_validity_info (pk, NULL);
|
||||
otrust = get_ownertrust_info (pk);
|
||||
trust = get_validity_string (pk, NULL);
|
||||
otrust = get_ownertrust_string (pk);
|
||||
|
||||
/* Show a warning once */
|
||||
if (!did_warn
|
||||
@ -1947,20 +1947,28 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
|
||||
(ulong)keyid_from_pk(pk,NULL),
|
||||
datestr_from_pk(pk),
|
||||
expirestr_from_pk(pk) );
|
||||
if( node->pkt->pkttype == PKT_PUBLIC_KEY ) {
|
||||
tty_printf(_(" trust: %c/%c"), otrust, trust );
|
||||
if( node->pkt->pkttype == PKT_PUBLIC_KEY
|
||||
&& (get_ownertrust (pk)&TRUST_FLAG_DISABLED)) {
|
||||
tty_printf("\n*** ");
|
||||
tty_printf(_("This key has been disabled"));
|
||||
}
|
||||
|
||||
if( with_fpr ) {
|
||||
tty_printf("\n");
|
||||
print_fingerprint ( pk, NULL, 2 );
|
||||
}
|
||||
}
|
||||
tty_printf("\n");
|
||||
|
||||
if( node->pkt->pkttype == PKT_PUBLIC_KEY )
|
||||
{
|
||||
tty_printf(" ");
|
||||
tty_printf(_("trust: %-13s"), otrust);
|
||||
tty_printf(_("validity: %s"), trust );
|
||||
tty_printf("\n");
|
||||
if( node->pkt->pkttype == PKT_PUBLIC_KEY
|
||||
&& (get_ownertrust (pk)&TRUST_FLAG_DISABLED))
|
||||
{
|
||||
tty_printf("*** ");
|
||||
tty_printf(_("This key has been disabled"));
|
||||
tty_printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
if( node->pkt->pkttype == PKT_PUBLIC_KEY && with_fpr )
|
||||
{
|
||||
print_fingerprint ( pk, NULL, 2 );
|
||||
tty_printf("\n");
|
||||
}
|
||||
}
|
||||
else if( node->pkt->pkttype == PKT_SECRET_KEY
|
||||
|| (with_subkeys && node->pkt->pkttype == PKT_SECRET_SUBKEY) ) {
|
||||
|
@ -452,7 +452,7 @@ trust_letter (unsigned int value)
|
||||
case TRUST_MARGINAL: return 'm';
|
||||
case TRUST_FULLY: return 'f';
|
||||
case TRUST_ULTIMATE: return 'u';
|
||||
default: return 0;
|
||||
default: return '?';
|
||||
}
|
||||
}
|
||||
|
||||
@ -463,13 +463,13 @@ trust_string (unsigned int value)
|
||||
{
|
||||
switch( (value & TRUST_MASK) )
|
||||
{
|
||||
case TRUST_UNKNOWN: return _("unknown trust");
|
||||
case TRUST_UNKNOWN: return _("unknown");
|
||||
case TRUST_EXPIRED: return _("expired");
|
||||
case TRUST_UNDEFINED: return _("undefined trust");
|
||||
case TRUST_NEVER: return _("do NOT trust");
|
||||
case TRUST_MARGINAL: return _("marginal trust");
|
||||
case TRUST_FULLY: return _("full trust");
|
||||
case TRUST_ULTIMATE: return _("ultimate trust");
|
||||
case TRUST_UNDEFINED: return _("undefined");
|
||||
case TRUST_NEVER: return _("never");
|
||||
case TRUST_MARGINAL: return _("marginal");
|
||||
case TRUST_FULLY: return _("full");
|
||||
case TRUST_ULTIMATE: return _("ultimate");
|
||||
default: return "err";
|
||||
}
|
||||
}
|
||||
@ -629,31 +629,48 @@ get_min_ownertrust (PKT_public_key *pk)
|
||||
}
|
||||
|
||||
/*
|
||||
* Same as get_ownertrust but return a trust letter instead of an value.
|
||||
* Same as get_ownertrust but this takes the minimum ownertrust value
|
||||
* into into account, and will bump up the value as needed.
|
||||
*/
|
||||
static int
|
||||
get_ownertrust_with_min (PKT_public_key *pk)
|
||||
{
|
||||
unsigned int otrust,otrust_min;
|
||||
|
||||
otrust = get_ownertrust (pk);
|
||||
otrust_min = get_min_ownertrust (pk);
|
||||
if(otrust<otrust_min)
|
||||
{
|
||||
/* If the trust that the user has set is less than the trust
|
||||
that was calculated from a trust signature chain, use the
|
||||
higher of the two. We do this here and not in
|
||||
get_ownertrust since the underlying ownertrust should not
|
||||
really be set - just the appearance of the ownertrust. */
|
||||
|
||||
otrust=otrust_min;
|
||||
}
|
||||
|
||||
return otrust;
|
||||
}
|
||||
|
||||
/*
|
||||
* Same as get_ownertrust but return a trust letter instead of an
|
||||
* value. This takes the minimum ownertrust value into account.
|
||||
*/
|
||||
int
|
||||
get_ownertrust_info (PKT_public_key *pk)
|
||||
{
|
||||
unsigned int otrust,otrust_min;
|
||||
int c;
|
||||
return trust_letter(get_ownertrust_with_min(pk));
|
||||
}
|
||||
|
||||
otrust = get_ownertrust (pk);
|
||||
otrust_min = get_min_ownertrust (pk);
|
||||
if(otrust<otrust_min)
|
||||
{
|
||||
/* If the trust that the user has set is less than the trust
|
||||
that was calculated from a trust signature chain, use the
|
||||
higher of the two. We do this here and not in
|
||||
get_ownertrust since the underlying ownertrust should not
|
||||
really be set - just the appearance of the ownertrust. */
|
||||
|
||||
otrust=otrust_min;
|
||||
}
|
||||
|
||||
c = trust_letter( otrust );
|
||||
if( !c )
|
||||
c = '?';
|
||||
return c;
|
||||
/*
|
||||
* Same as get_ownertrust but return a trust string instead of an
|
||||
* value. This takes the minimum ownertrust value into account.
|
||||
*/
|
||||
const char *
|
||||
get_ownertrust_string (PKT_public_key *pk)
|
||||
{
|
||||
return trust_string(get_ownertrust_with_min(pk));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1055,15 +1072,22 @@ int
|
||||
get_validity_info (PKT_public_key *pk, PKT_user_id *uid)
|
||||
{
|
||||
int trustlevel;
|
||||
int c;
|
||||
|
||||
trustlevel = get_validity (pk, uid);
|
||||
if( trustlevel & TRUST_FLAG_REVOKED )
|
||||
return 'r';
|
||||
c = trust_letter ( trustlevel );
|
||||
if( !c )
|
||||
c = '?';
|
||||
return c;
|
||||
return trust_letter ( trustlevel );
|
||||
}
|
||||
|
||||
const char *
|
||||
get_validity_string (PKT_public_key *pk, PKT_user_id *uid)
|
||||
{
|
||||
int trustlevel;
|
||||
|
||||
trustlevel = get_validity (pk, uid);
|
||||
if( trustlevel & TRUST_FLAG_REVOKED )
|
||||
return _("revoked");
|
||||
return trust_string(trustlevel);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -52,11 +52,12 @@ void revalidation_mark (void);
|
||||
int trustdb_pending_check(void);
|
||||
|
||||
int is_disabled(void *dummy,u32 *keyid);
|
||||
|
||||
unsigned int get_validity (PKT_public_key *pk, PKT_user_id *uid);
|
||||
int get_validity_info (PKT_public_key *pk, PKT_user_id *uid);
|
||||
const char *get_validity_string (PKT_public_key *pk, PKT_user_id *uid);
|
||||
|
||||
void list_trust_path( const char *username );
|
||||
|
||||
int enum_cert_paths( void **context, ulong *lid,
|
||||
unsigned *ownertrust, unsigned *validity );
|
||||
void enum_cert_paths_print( void **context, FILE *fp,
|
||||
@ -65,10 +66,11 @@ void enum_cert_paths_print( void **context, FILE *fp,
|
||||
unsigned int get_ownertrust (PKT_public_key *pk);
|
||||
unsigned int get_min_ownertrust (PKT_public_key *pk);
|
||||
int get_ownertrust_info (PKT_public_key *pk);
|
||||
const char *get_ownertrust_string (PKT_public_key *pk);
|
||||
|
||||
void update_ownertrust (PKT_public_key *pk, unsigned int new_trust );
|
||||
int clear_ownertrusts (PKT_public_key *pk);
|
||||
|
||||
|
||||
/*-- tdbdump.c --*/
|
||||
void list_trustdb(const char *username);
|
||||
void export_ownertrust(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user