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

* sign.c (mk_notation_and_policy): Include secret key to enable %s

expandos, and pass notations through pct_expando as well.

* main.h, misc.c (pct_expando): Add %s and %S expandos for signer's keyid.
This commit is contained in:
David Shaw 2002-05-27 01:00:11 +00:00
parent de2f0905b5
commit 8d5dad0ac3
4 changed files with 54 additions and 9 deletions

View file

@ -455,11 +455,14 @@ pct_expando(const char *string,struct expando_args *args)
{
const char *ch=string;
int idx=0,maxlen=0,done=0;
u32 keyid[2]={0,0};
u32 pk_keyid[2]={0,0},sk_keyid[2]={0,0};
char *ret=NULL;
if(args->pk)
keyid_from_pk(args->pk,keyid);
keyid_from_pk(args->pk,pk_keyid);
if(args->sk)
keyid_from_sk(args->sk,sk_keyid);
while(*ch!='\0')
{
@ -481,10 +484,29 @@ pct_expando(const char *string,struct expando_args *args)
{
switch(*(ch+1))
{
case 's': /* short key id */
if(idx+8<maxlen)
{
sprintf(&ret[idx],"%08lX",(ulong)sk_keyid[1]);
idx+=8;
done=1;
}
break;
case 'S': /* long key id */
if(idx+16<maxlen)
{
sprintf(&ret[idx],"%08lX%08lX",
(ulong)sk_keyid[0],(ulong)sk_keyid[1]);
idx+=16;
done=1;
}
break;
case 'k': /* short key id */
if(idx+8<maxlen)
{
sprintf(&ret[idx],"%08lX",(ulong)keyid[1]);
sprintf(&ret[idx],"%08lX",(ulong)pk_keyid[1]);
idx+=8;
done=1;
}
@ -494,7 +516,7 @@ pct_expando(const char *string,struct expando_args *args)
if(idx+16<maxlen)
{
sprintf(&ret[idx],"%08lX%08lX",
(ulong)keyid[0],(ulong)keyid[1]);
(ulong)pk_keyid[0],(ulong)pk_keyid[1]);
idx+=16;
done=1;
}