1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-11 21:48:50 +01:00

* keyedit.c (menu_addrevoker): Properly back out if the signature fails.

Also, do not allow appointing the same revoker twice, and report
ALREADY_SIGNED if the user tries it.
This commit is contained in:
David Shaw 2002-10-11 21:07:03 +00:00
parent 4849c0ab7b
commit 9fafaa7ef7
2 changed files with 44 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2002-10-11 David Shaw <dshaw@jabberwocky.com>
* keyedit.c (menu_addrevoker): Properly back out if the signature
fails. Also, do not allow appointing the same revoker twice, and
report ALREADY_SIGNED if the user tries it.
2002-10-07 David Shaw <dshaw@jabberwocky.com>
* import.c (import_keys_internal): Missed one s/inp/inp2/.

View File

@ -2326,6 +2326,11 @@ menu_addrevoker( KBNODE pub_keyblock, KBNODE sec_keyblock, int sensitive )
continue;
}
revkey.class=0x80;
if(sensitive)
revkey.class|=0x40;
revkey.algid=revoker_pk->pubkey_algo;
if(cmp_public_keys(revoker_pk,pk)==0)
{
/* This actually causes no harm (after all, a key that
@ -2333,9 +2338,41 @@ menu_addrevoker( KBNODE pub_keyblock, KBNODE sec_keyblock, int sensitive )
regular key), but it's easy enough to check. */
log_error(_("you cannot appoint a key as its own "
"designated revoker\n"));
continue;
}
keyid_from_pk(pk,NULL);
/* Does this revkey already exist? */
if(!pk->revkey && pk->numrevkeys)
BUG();
else
{
int i;
for(i=0;i<pk->numrevkeys;i++)
{
if(memcmp(&pk->revkey[i],&revkey,
sizeof(struct revocation_key))==0)
{
char buf[50];
log_error(_("this key has already been designated "
"as a revoker\n"));
sprintf(buf,"%08lX%08lX",
(ulong)pk->keyid[0],(ulong)pk->keyid[1]);
write_status_text(STATUS_ALREADY_SIGNED,buf);
break;
}
}
if(i<pk->numrevkeys)
continue;
}
keyid_from_pk(revoker_pk,keyid);
tty_printf("\npub %4u%c/%08lX %s ",
@ -2360,11 +2397,8 @@ menu_addrevoker( KBNODE pub_keyblock, KBNODE sec_keyblock, int sensitive )
"key as a designated revoker? (y/N): "))
continue;
revkey.class=0x80;
if(sensitive)
revkey.class|=0x40;
revkey.algid=revoker_pk->pubkey_algo;
free_public_key(revoker_pk);
revoker_pk=NULL;
break;
}