1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-07-03 02:58:57 +02:00

* pkclist.c (build_pk_list): Fix bug that allowed a key to be selected

twice in batch mode if one instance was the default recipient and the
other was an encrypt-to.  Noted by Stefan Bellon.

* parse-packet.c (dump_sig_subpkt): Show data in trust and regexp sig
subpackets.

* keyedit.c (keyedit_menu): Use new function real_uids_left to prevent
deleting the last real (i.e. non-attribute) uid.  Again, according to the
attribute draft. (menu_showphoto): Make another string translatable.
This commit is contained in:
David Shaw 2002-04-13 04:32:03 +00:00
parent 5005434c7e
commit 9d7b26c784
4 changed files with 52 additions and 6 deletions

View File

@ -1,3 +1,18 @@
2002-04-12 David Shaw <dshaw@jabberwocky.com>
* pkclist.c (build_pk_list): Fix bug that allowed a key to be
selected twice in batch mode if one instance was the default
recipient and the other was an encrypt-to. Noted by Stefan
Bellon.
* parse-packet.c (dump_sig_subpkt): Show data in trust and regexp
sig subpackets.
* keyedit.c (keyedit_menu): Use new function real_uids_left to
prevent deleting the last real (i.e. non-attribute) uid. Again,
according to the attribute draft. (menu_showphoto): Make another
string translatable.
2002-04-11 David Shaw <dshaw@jabberwocky.com>
* build-packet.c (build_sig_subpkt): Delete subpackets from both

View File

@ -58,6 +58,7 @@ static int count_uids( KBNODE keyblock );
static int count_uids_with_flag( KBNODE keyblock, unsigned flag );
static int count_keys_with_flag( KBNODE keyblock, unsigned flag );
static int count_selected_uids( KBNODE keyblock );
static int real_uids_left( KBNODE keyblock );
static int count_selected_keys( KBNODE keyblock );
static int menu_revsig( KBNODE keyblock );
static int menu_revkey( KBNODE pub_keyblock, KBNODE sec_keyblock );
@ -1104,7 +1105,7 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands,
if( !(n1=count_selected_uids(keyblock)) )
tty_printf(_("You must select at least one user ID.\n"));
else if( count_uids(keyblock) - n1 < 1 )
else if( real_uids_left(keyblock) < 1 )
tty_printf(_("You can't delete the last user ID!\n"));
else if( cpr_get_answer_is_yes(
"keyedit.remove.uid.okay",
@ -2368,6 +2369,21 @@ count_selected_keys( KBNODE keyblock )
return count_keys_with_flag( keyblock, NODFLG_SELKEY);
}
/* returns how many real (i.e. not attribute) uids are unmarked */
static int
real_uids_left( KBNODE keyblock )
{
KBNODE node;
int real=0;
for(node=keyblock;node;node=node->next)
if(node->pkt->pkttype==PKT_USER_ID && !(node->flag&NODFLG_SELUID) &&
!node->pkt->pkt.user_id->attrib_data)
real++;
return real;
}
/*
* Ask whether the signature should be revoked. If the user commits this,
* flag bit MARK_A is set on the signature and the user ID.
@ -2674,8 +2690,9 @@ menu_showphoto( KBNODE keyblock )
else
keyid_from_pk(pk, keyid);
tty_printf("Displaying photo ID of size %ld for key 0x%08lX "
"(uid %d)\n",uid->attribs->len,(ulong)keyid[1],count);
tty_printf(_("Displaying %s photo ID of size %ld "
"for key 0x%08lX (uid %d)\n"),
"jpeg",uid->attribs->len,(ulong)keyid[1],count);
show_photo(uid->attribs,pk);
}
}

View File

@ -768,10 +768,16 @@ dump_sig_subpkt( int hashed, int type, int critical,
printf("%sexportable", *buffer? "":"not ");
break;
case SIGSUBPKT_TRUST:
p = "trust signature";
if(length!=2)
p="[invalid trust signature]";
else
printf("trust signature of level %d, amount %d",buffer[0],buffer[1]);
break;
case SIGSUBPKT_REGEXP:
p = "regular expression";
if(!length)
p="[invalid regexp]";
else
printf("regular expression: \"%s\"",buffer);
break;
case SIGSUBPKT_REVOCABLE:
if( length )

View File

@ -848,12 +848,20 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned use )
if( rc )
log_error(_("unknown default recipient `%s'\n"), def_rec );
else if( !(rc=check_pubkey_algo2(pk->pubkey_algo, use)) ) {
/* Mark any_recipients here since the default recipient
would have been used if it wasn't already there. It
doesn't really matter if we got this key from the default
recipient or an encrypt-to. */
any_recipients = 1;
if (key_present_in_pk_list(pk_list, pk) == 0)
log_info(_("skipped: public key already set as default recipient\n"));
else {
PK_LIST r = m_alloc( sizeof *r );
r->pk = pk; pk = NULL;
r->next = pk_list;
r->mark = 0;
pk_list = r;
any_recipients = 1;
}
}
if( pk ) {
free_public_key( pk );