1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-02-01 16:33:02 +01:00

* getkey.c (skip_unusable, merge_selfsigs_main,

premerge_public_with_secret, lookup, get_user_id_string): --keyid-format
conversion.
This commit is contained in:
David Shaw 2004-03-16 22:47:45 +00:00
parent f16d78e14d
commit f0e0c301b2
2 changed files with 46 additions and 36 deletions

View File

@ -1,3 +1,9 @@
2004-03-16 David Shaw <dshaw@jabberwocky.com>
* getkey.c (skip_unusable, merge_selfsigs_main,
premerge_public_with_secret, lookup, get_user_id_string):
--keyid-format conversion.
2004-03-15 David Shaw <dshaw@jabberwocky.com> 2004-03-15 David Shaw <dshaw@jabberwocky.com>
* trustdb.c (add_utk, verify_own_keys, update_min_ownertrust, * trustdb.c (add_utk, verify_own_keys, update_min_ownertrust,

View File

@ -745,7 +745,7 @@ skip_unusable(void *dummy,u32 *keyid,PKT_user_id *uid)
keyblock=get_pubkeyblock(keyid); keyblock=get_pubkeyblock(keyid);
if(!keyblock) if(!keyblock)
{ {
log_error("error checking usability status of %08lX\n",(ulong)keyid[1]); log_error("error checking usability status of %s\n",keystr(keyid));
goto leave; goto leave;
} }
@ -1617,10 +1617,8 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked, u32 *r_revokedate )
if(!pk->is_valid && opt.allow_non_selfsigned_uid) if(!pk->is_valid && opt.allow_non_selfsigned_uid)
{ {
if(opt.verbose) if(opt.verbose)
log_info(_("Invalid key %08lX made valid by " log_info(_("Invalid key %s made valid by"
"--allow-non-selfsigned-uid\n"), " --allow-non-selfsigned-uid\n"),keystr_from_pk(pk));
(ulong)keyid_from_pk(pk,NULL));
pk->is_valid = 1; pk->is_valid = 1;
} }
@ -2130,9 +2128,9 @@ premerge_public_with_secret ( KBNODE pubblock, KBNODE secblock )
KBNODE next, ll; KBNODE next, ll;
if (opt.verbose) if (opt.verbose)
log_info ( _("no secret subkey " log_info (_("no secret subkey"
"for public subkey %08lX - ignoring\n"), " for public subkey %s - ignoring\n"),
(ulong)keyid_from_pk (pk,NULL) ); keystr_from_pk (pk));
/* we have to remove the subkey in this case */ /* we have to remove the subkey in this case */
assert ( last ); assert ( last );
/* find the next subkey */ /* find the next subkey */
@ -2357,12 +2355,14 @@ finish_lookup (GETKEY_CTX ctx)
ctx->found_key = latest_key; ctx->found_key = latest_key;
if (latest_key != keyblock && opt.verbose) { if (latest_key != keyblock && opt.verbose)
log_info(_("using secondary key %08lX " {
"instead of primary key %08lX\n"), char *tempkeystr=
(ulong)keyid_from_pk( latest_key->pkt->pkt.public_key, NULL), m_strdup(keystr_from_pk(latest_key->pkt->pkt.public_key));
(ulong)keyid_from_pk( keyblock->pkt->pkt.public_key, NULL) ); log_info(_("using secondary key %s instead of primary key %s\n"),
} tempkeystr, keystr_from_pk(keyblock->pkt->pkt.public_key));
m_free(tempkeystr);
}
cache_user_id( keyblock ); cache_user_id( keyblock );
@ -2403,12 +2403,13 @@ lookup( GETKEY_CTX ctx, KBNODE *ret_keyblock, int secmode )
keyid_from_sk (k->pkt->pkt.secret_key, aki); keyid_from_sk (k->pkt->pkt.secret_key, aki);
k = get_pubkeyblock (aki); k = get_pubkeyblock (aki);
if( !k ) { if( !k )
{
if (!opt.quiet) if (!opt.quiet)
log_info(_("key %08lX: secret key without public key " log_info(_("key %s: secret key without public key"
"- skipped\n"), (ulong)aki[1] ); " - skipped\n"), keystr(aki));
goto skip; goto skip;
} }
secblock = ctx->keyblock; secblock = ctx->keyblock;
ctx->keyblock = k; ctx->keyblock = k;
@ -2566,26 +2567,29 @@ enum_secret_keys( void **context, PKT_secret_key *sk,
char* char*
get_user_id_string( u32 *keyid ) get_user_id_string( u32 *keyid )
{ {
user_id_db_t r; user_id_db_t r;
char *p; char *p;
int pass=0; int pass=0;
/* try it two times; second pass reads from key resources */ /* try it two times; second pass reads from key resources */
do { do
for(r=user_id_db; r; r = r->next ) { {
keyid_list_t a; for(r=user_id_db; r; r = r->next )
for (a=r->keyids; a; a= a->next ) { {
if( a->keyid[0] == keyid[0] && a->keyid[1] == keyid[1] ) { keyid_list_t a;
p = m_alloc( r->len + 10 ); for (a=r->keyids; a; a= a->next )
sprintf(p, "%08lX %.*s", {
(ulong)keyid[1], r->len, r->name ); if( a->keyid[0] == keyid[0] && a->keyid[1] == keyid[1] )
return p; {
} p = m_alloc( keystrlen() + 1 + r->len + 1 );
} sprintf(p, "%s %.*s", keystr(keyid), r->len, r->name );
return p;
}
}
} }
} while( ++pass < 2 && !get_pubkey( NULL, keyid ) ); } while( ++pass < 2 && !get_pubkey( NULL, keyid ) );
p = m_alloc( 15 ); p = m_alloc( keystrlen() + 5 );
sprintf(p, "%08lX [?]", (ulong)keyid[1] ); sprintf(p, "%s [?]", keystr(keyid));
return p; return p;
} }