mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-05 12:31:50 +01:00
* armor.c (armor_filter): Comment about PGP's end of line tab problem.
* trustdb.h, trustdb.c (trust_letter): Make static. (get_ownertrust_info, get_validity_info): Don't mask the trust level twice. * trustdb.h, gpgv.c, trustdb.c (get_validity, get_validity_info), keylist.c (list_keyblock_colon), keyedit.c (show_key_with_all_names_colon, menu_revuid): Pass a user ID in rather than a namehash, so we only have to do the hashing in one place. * packet.h, pkclist.c (build_pk_list), free-packet.c (release_public_key_parts): Remove unused namehash element for public keys.
This commit is contained in:
parent
29ef9bd0fb
commit
8b3b70499a
@ -1,3 +1,22 @@
|
|||||||
|
2003-01-10 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* armor.c (armor_filter): Comment about PGP's end of line tab
|
||||||
|
problem.
|
||||||
|
|
||||||
|
* trustdb.h, trustdb.c (trust_letter): Make
|
||||||
|
static. (get_ownertrust_info, get_validity_info): Don't mask the
|
||||||
|
trust level twice.
|
||||||
|
|
||||||
|
* trustdb.h, gpgv.c, trustdb.c (get_validity, get_validity_info),
|
||||||
|
keylist.c (list_keyblock_colon), keyedit.c
|
||||||
|
(show_key_with_all_names_colon, menu_revuid): Pass a user ID in
|
||||||
|
rather than a namehash, so we only have to do the hashing in one
|
||||||
|
place.
|
||||||
|
|
||||||
|
* packet.h, pkclist.c (build_pk_list), free-packet.c
|
||||||
|
(release_public_key_parts): Remove unused namehash element for
|
||||||
|
public keys.
|
||||||
|
|
||||||
2003-01-07 David Shaw <dshaw@jabberwocky.com>
|
2003-01-07 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* keygen.c (keygen_set_std_prefs): Warn when setting an IDEA
|
* keygen.c (keygen_set_std_prefs): Warn when setting an IDEA
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* armor.c - Armor flter
|
/* armor.c - Armor flter
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -871,6 +872,9 @@ armor_filter( void *opaque, int control,
|
|||||||
hashes &= 1|2|4|8;
|
hashes &= 1|2|4|8;
|
||||||
if( !hashes ) {
|
if( !hashes ) {
|
||||||
hashes |= 4; /* default to MD 5 */
|
hashes |= 4; /* default to MD 5 */
|
||||||
|
/* This is non-ideal since PGP 5-8 have the same
|
||||||
|
end-of-line bugs as PGP 2. However, we only
|
||||||
|
enable pgp2mode if there is no Hash: header. */
|
||||||
if( opt.pgp2_workarounds )
|
if( opt.pgp2_workarounds )
|
||||||
afx->pgp2mode = 1;
|
afx->pgp2mode = 1;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* free-packet.c - cleanup stuff for packets
|
/* free-packet.c - cleanup stuff for packets
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -68,7 +69,6 @@ free_seckey_enc( PKT_signature *sig )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
release_public_key_parts( PKT_public_key *pk )
|
release_public_key_parts( PKT_public_key *pk )
|
||||||
{
|
{
|
||||||
@ -84,10 +84,6 @@ release_public_key_parts( PKT_public_key *pk )
|
|||||||
m_free (pk->prefs);
|
m_free (pk->prefs);
|
||||||
pk->prefs = NULL;
|
pk->prefs = NULL;
|
||||||
}
|
}
|
||||||
if( pk->namehash ) {
|
|
||||||
m_free(pk->namehash);
|
|
||||||
pk->namehash = NULL;
|
|
||||||
}
|
|
||||||
if (pk->user_id) {
|
if (pk->user_id) {
|
||||||
free_user_id (pk->user_id);
|
free_user_id (pk->user_id);
|
||||||
pk->user_id = NULL;
|
pk->user_id = NULL;
|
||||||
|
@ -239,7 +239,7 @@ is_disabled(void *dummy,u32 *keyid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get_validity_info (PKT_public_key *pk, const byte *namehash )
|
get_validity_info (PKT_public_key *pk, PKT_user_id *uid)
|
||||||
{
|
{
|
||||||
return '?';
|
return '?';
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* keyedit.c - keyedit stuff
|
/* keyedit.c - keyedit stuff
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -1816,18 +1817,10 @@ show_key_with_all_names_colon (KBNODE keyblock)
|
|||||||
printf("::::::::");
|
printf("::::::::");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
byte namehash[20];
|
|
||||||
int uid_validity;
|
int uid_validity;
|
||||||
|
|
||||||
if( primary && !ulti_hack )
|
if( primary && !ulti_hack )
|
||||||
{
|
uid_validity = get_validity_info( primary, uid );
|
||||||
if( uid->attrib_data )
|
|
||||||
rmd160_hash_buffer(namehash,
|
|
||||||
uid->attrib_data, uid->attrib_len);
|
|
||||||
else
|
|
||||||
rmd160_hash_buffer( namehash, uid->name, uid->len );
|
|
||||||
uid_validity = get_validity_info( primary, namehash );
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
uid_validity = 'u';
|
uid_validity = 'u';
|
||||||
printf("%c::::::::",uid_validity);
|
printf("%c::::::::",uid_validity);
|
||||||
@ -3407,8 +3400,6 @@ menu_revuid( KBNODE pub_keyblock, KBNODE sec_keyblock )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
byte namehash[20];
|
|
||||||
|
|
||||||
pkt = m_alloc_clear( sizeof *pkt );
|
pkt = m_alloc_clear( sizeof *pkt );
|
||||||
pkt->pkttype = PKT_SIGNATURE;
|
pkt->pkttype = PKT_SIGNATURE;
|
||||||
pkt->pkt.signature = sig;
|
pkt->pkt.signature = sig;
|
||||||
@ -3418,13 +3409,7 @@ menu_revuid( KBNODE pub_keyblock, KBNODE sec_keyblock )
|
|||||||
{
|
{
|
||||||
/* If the trustdb has an entry for this key+uid then the
|
/* If the trustdb has an entry for this key+uid then the
|
||||||
trustdb needs an update. */
|
trustdb needs an update. */
|
||||||
if( uid->attrib_data )
|
if((get_validity(pk,uid)&TRUST_MASK)>=TRUST_UNDEFINED)
|
||||||
rmd160_hash_buffer(namehash,
|
|
||||||
uid->attrib_data, uid->attrib_len);
|
|
||||||
else
|
|
||||||
rmd160_hash_buffer( namehash, uid->name, uid->len );
|
|
||||||
|
|
||||||
if((get_validity(pk,namehash)&TRUST_MASK)>=TRUST_UNDEFINED)
|
|
||||||
update_trust=1;
|
update_trust=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* keylist.c
|
/* keylist.c
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -766,20 +767,11 @@ list_keyblock_colon( KBNODE keyblock, int secret, int fpr )
|
|||||||
printf("%s:::::::::",str);
|
printf("%s:::::::::",str);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
byte namehash[20];
|
|
||||||
int uid_validity;
|
int uid_validity;
|
||||||
|
|
||||||
if( pk && !ulti_hack ) {
|
if( pk && !ulti_hack )
|
||||||
if( node->pkt->pkt.user_id->attrib_data )
|
uid_validity=get_validity_info (pk,
|
||||||
rmd160_hash_buffer( namehash,
|
node->pkt->pkt.user_id);
|
||||||
node->pkt->pkt.user_id->attrib_data,
|
|
||||||
node->pkt->pkt.user_id->attrib_len);
|
|
||||||
else
|
|
||||||
rmd160_hash_buffer( namehash,
|
|
||||||
node->pkt->pkt.user_id->name,
|
|
||||||
node->pkt->pkt.user_id->len );
|
|
||||||
uid_validity = get_validity_info( pk, namehash );
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
uid_validity = 'u';
|
uid_validity = 'u';
|
||||||
printf("%s:%c::::::::",str,uid_validity);
|
printf("%s:%c::::::::",str,uid_validity);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* packet.h - packet definitions
|
/* packet.h - packet definitions
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -210,7 +211,6 @@ typedef struct {
|
|||||||
byte is_primary;
|
byte is_primary;
|
||||||
prefitem_t *prefs; /* list of preferences (may be NULL) */
|
prefitem_t *prefs; /* list of preferences (may be NULL) */
|
||||||
int mdc_feature; /* mdc feature set */
|
int mdc_feature; /* mdc feature set */
|
||||||
byte *namehash; /* if != NULL: found by this name */
|
|
||||||
PKT_user_id *user_id; /* if != NULL: found by that uid */
|
PKT_user_id *user_id; /* if != NULL: found by that uid */
|
||||||
struct revocation_key *revkey;
|
struct revocation_key *revkey;
|
||||||
int numrevkeys;
|
int numrevkeys;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* pkclist.c
|
/* pkclist.c
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -1027,7 +1028,7 @@ build_pk_list( STRLIST rcpts, PK_LIST *ret_pk_list, unsigned use )
|
|||||||
else if( !(rc=check_pubkey_algo2(pk->pubkey_algo, use )) ) {
|
else if( !(rc=check_pubkey_algo2(pk->pubkey_algo, use )) ) {
|
||||||
int trustlevel;
|
int trustlevel;
|
||||||
|
|
||||||
trustlevel = get_validity (pk, pk->namehash);
|
trustlevel = get_validity (pk, NULL);
|
||||||
if( (trustlevel & TRUST_FLAG_DISABLED) ) {
|
if( (trustlevel & TRUST_FLAG_DISABLED) ) {
|
||||||
free_public_key(pk); pk = NULL;
|
free_public_key(pk); pk = NULL;
|
||||||
log_info(_("%s: skipped: public key is disabled\n"),
|
log_info(_("%s: skipped: public key is disabled\n"),
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* trustdb.c
|
/* trustdb.c
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -439,7 +440,7 @@ init_trustdb()
|
|||||||
* This function returns a letter for a trustvalue Trust flags
|
* This function returns a letter for a trustvalue Trust flags
|
||||||
* are ignore.
|
* are ignore.
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
trust_letter (unsigned int value)
|
trust_letter (unsigned int value)
|
||||||
{
|
{
|
||||||
switch( (value & TRUST_MASK) )
|
switch( (value & TRUST_MASK) )
|
||||||
@ -649,7 +650,7 @@ get_ownertrust_info (PKT_public_key *pk)
|
|||||||
otrust=otrust_min;
|
otrust=otrust_min;
|
||||||
}
|
}
|
||||||
|
|
||||||
c = trust_letter( (otrust & TRUST_MASK) );
|
c = trust_letter( otrust );
|
||||||
if( !c )
|
if( !c )
|
||||||
c = '?';
|
c = '?';
|
||||||
return c;
|
return c;
|
||||||
@ -803,7 +804,7 @@ update_validity (PKT_public_key *pk, PKT_user_id *uid,
|
|||||||
ulong recno;
|
ulong recno;
|
||||||
byte namehash[20];
|
byte namehash[20];
|
||||||
|
|
||||||
if( uid->attrib_data )
|
if(uid->attrib_data)
|
||||||
rmd160_hash_buffer (namehash,uid->attrib_data,uid->attrib_len);
|
rmd160_hash_buffer (namehash,uid->attrib_data,uid->attrib_len);
|
||||||
else
|
else
|
||||||
rmd160_hash_buffer (namehash, uid->name, uid->len );
|
rmd160_hash_buffer (namehash, uid->name, uid->len );
|
||||||
@ -943,7 +944,7 @@ is_disabled(void *dummy,u32 *keyid)
|
|||||||
* otherwise, a reasonable value for the entire key is returned.
|
* otherwise, a reasonable value for the entire key is returned.
|
||||||
*/
|
*/
|
||||||
unsigned int
|
unsigned int
|
||||||
get_validity (PKT_public_key *pk, const byte *namehash)
|
get_validity (PKT_public_key *pk, PKT_user_id *uid)
|
||||||
{
|
{
|
||||||
static int did_nextcheck;
|
static int did_nextcheck;
|
||||||
TRUSTREC trec, vrec;
|
TRUSTREC trec, vrec;
|
||||||
@ -952,6 +953,15 @@ get_validity (PKT_public_key *pk, const byte *namehash)
|
|||||||
unsigned int validity;
|
unsigned int validity;
|
||||||
u32 kid[2];
|
u32 kid[2];
|
||||||
PKT_public_key *main_pk;
|
PKT_public_key *main_pk;
|
||||||
|
byte namehash[20];
|
||||||
|
|
||||||
|
if(uid)
|
||||||
|
{
|
||||||
|
if(uid->attrib_data)
|
||||||
|
rmd160_hash_buffer (namehash,uid->attrib_data,uid->attrib_len);
|
||||||
|
else
|
||||||
|
rmd160_hash_buffer (namehash, uid->name, uid->len );
|
||||||
|
}
|
||||||
|
|
||||||
init_trustdb ();
|
init_trustdb ();
|
||||||
if (!did_nextcheck)
|
if (!did_nextcheck)
|
||||||
@ -1011,7 +1021,7 @@ get_validity (PKT_public_key *pk, const byte *namehash)
|
|||||||
read_record (recno, &vrec, RECTYPE_VALID);
|
read_record (recno, &vrec, RECTYPE_VALID);
|
||||||
if ( validity < (vrec.r.valid.validity & TRUST_MASK) )
|
if ( validity < (vrec.r.valid.validity & TRUST_MASK) )
|
||||||
validity = (vrec.r.valid.validity & TRUST_MASK);
|
validity = (vrec.r.valid.validity & TRUST_MASK);
|
||||||
if ( namehash && !memcmp (vrec.r.valid.namehash, namehash, 20) )
|
if ( uid && !memcmp (vrec.r.valid.namehash, namehash, 20) )
|
||||||
break;
|
break;
|
||||||
recno = vrec.r.valid.next;
|
recno = vrec.r.valid.next;
|
||||||
}
|
}
|
||||||
@ -1042,15 +1052,15 @@ get_validity (PKT_public_key *pk, const byte *namehash)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get_validity_info (PKT_public_key *pk, const byte *namehash)
|
get_validity_info (PKT_public_key *pk, PKT_user_id *uid)
|
||||||
{
|
{
|
||||||
int trustlevel;
|
int trustlevel;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
trustlevel = get_validity (pk, namehash);
|
trustlevel = get_validity (pk, uid);
|
||||||
if( trustlevel & TRUST_FLAG_REVOKED )
|
if( trustlevel & TRUST_FLAG_REVOKED )
|
||||||
return 'r';
|
return 'r';
|
||||||
c = trust_letter ( (trustlevel & TRUST_MASK) );
|
c = trust_letter ( trustlevel );
|
||||||
if( !c )
|
if( !c )
|
||||||
c = '?';
|
c = '?';
|
||||||
return c;
|
return c;
|
||||||
@ -1066,7 +1076,7 @@ get_validity_counts (PKT_public_key *pk, PKT_user_id *uid)
|
|||||||
if(pk==NULL || uid==NULL)
|
if(pk==NULL || uid==NULL)
|
||||||
BUG();
|
BUG();
|
||||||
|
|
||||||
if( uid->attrib_data )
|
if(uid->attrib_data)
|
||||||
rmd160_hash_buffer (namehash,uid->attrib_data,uid->attrib_len);
|
rmd160_hash_buffer (namehash,uid->attrib_data,uid->attrib_len);
|
||||||
else
|
else
|
||||||
rmd160_hash_buffer (namehash, uid->name, uid->len );
|
rmd160_hash_buffer (namehash, uid->name, uid->len );
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* trustdb.h - Trust database
|
/* trustdb.h - Trust database
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -45,15 +46,14 @@ int setup_trustdb( int level, const char *dbname );
|
|||||||
void init_trustdb( void );
|
void init_trustdb( void );
|
||||||
void sync_trustdb( void );
|
void sync_trustdb( void );
|
||||||
|
|
||||||
int trust_letter( unsigned value );
|
|
||||||
const char *trust_string (unsigned int value);
|
const char *trust_string (unsigned int value);
|
||||||
|
|
||||||
void revalidation_mark (void);
|
void revalidation_mark (void);
|
||||||
int trustdb_pending_check(void);
|
int trustdb_pending_check(void);
|
||||||
|
|
||||||
int is_disabled(void *dummy,u32 *keyid);
|
int is_disabled(void *dummy,u32 *keyid);
|
||||||
unsigned int get_validity (PKT_public_key *pk, const byte *namehash);
|
unsigned int get_validity (PKT_public_key *pk, PKT_user_id *uid);
|
||||||
int get_validity_info (PKT_public_key *pk, const byte *namehash);
|
int get_validity_info (PKT_public_key *pk, PKT_user_id *uid);
|
||||||
|
|
||||||
void list_trust_path( const char *username );
|
void list_trust_path( const char *username );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user