1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

* misc.c (pct_expando): Add two new expandos - signer's fingerprint (%g),

and signer's primary fingerprint (%p).

* tdbio.h, tdbio.c (create_version_record, tdbio_write_nextcheck,
tdbio_read_record, tdbio_write_record): Force a 0 into the trust_model
field.  This is to help smooth the 1.2->1.4 switchover, as otherwise a 1.4
trustdb could be rebuilt as classic on 1.2 while still claiming to be a
non-classic trust model.
This commit is contained in:
David Shaw 2003-07-01 23:20:30 +00:00
parent df441baf1c
commit dcc026f7e0
4 changed files with 44 additions and 12 deletions

View file

@ -320,6 +320,8 @@ pct_expando(const char *string,struct expando_args *args)
if(args->sk)
keyid_from_sk(args->sk,sk_keyid);
/* This is used so that %k works in photoid command strings in
--list-secret-keys (which of course has a sk, but no pk). */
if(!args->pk && args->sk)
keyid_from_sk(args->sk,pk_keyid);
@ -381,16 +383,31 @@ pct_expando(const char *string,struct expando_args *args)
}
break;
case 'f': /* fingerprint */
case 'p': /* primary pk fingerprint of a sk */
case 'f': /* pk fingerprint */
case 'g': /* sk fingerprint */
{
byte array[MAX_FINGERPRINT_LEN];
size_t len;
int i;
if(args->pk)
if((*(ch+1))=='p' && args->sk
&& (args->sk->main_keyid[0] || args->sk->main_keyid[1]))
{
PKT_public_key *pk=m_alloc_clear(sizeof(PKT_public_key));
if(get_pubkey_fast(pk,args->sk->main_keyid)==0)
fingerprint_from_pk(pk,array,&len);
else
memset(array,0,(len=MAX_FINGERPRINT_LEN));
free_public_key(pk);
}
else if((*(ch+1))=='f' && args->pk)
fingerprint_from_pk(args->pk,array,&len);
else if((*(ch+1))=='g' && args->sk)
fingerprint_from_sk(args->sk,array,&len);
else
memset(array,0, (len=MAX_FINGERPRINT_LEN));
memset(array,0,(len=MAX_FINGERPRINT_LEN));
if(idx+(len*2)<maxlen)
{