1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

* keyedit.c (sign_uids, keyedit_menu): When the user requests to sign

a key without specifying which user IDs to sign, and declines to sign
all user IDs, walk through the set of user IDs and prompt for which to
sign.
This commit is contained in:
David Shaw 2005-04-22 03:36:20 +00:00
parent edc0862448
commit 5bfd1199b8
2 changed files with 36 additions and 17 deletions

View File

@ -1,5 +1,10 @@
2005-04-21 David Shaw <dshaw@jabberwocky.com>
* keyedit.c (sign_uids, keyedit_menu): When the user requests to
sign a key without specifying which user IDs to sign, and declines
to sign all user IDs, walk through the set of user IDs and prompt
for which to sign.
* mainproc.c (symkey_decrypt_seskey): There is no need to have an
extra check for a bad passphrase and/or unknown cipher algorithm
here. We'll fail quite happily later, and usually with a better

View File

@ -498,7 +498,7 @@ trustsig_prompt(byte *trust_value,byte *trust_depth,char **regexp)
*/
static int
sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
int local, int nonrevocable, int trust )
int local, int nonrevocable, int trust, int interactive )
{
int rc = 0;
SK_LIST sk_list = NULL;
@ -506,7 +506,7 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
PKT_secret_key *sk = NULL;
KBNODE node, uidnode;
PKT_public_key *primary_pk=NULL;
int select_all = !count_selected_uids(keyblock);
int select_all = !count_selected_uids(keyblock) || interactive;
int all_v3=1;
/* Are there any non-v3 sigs on this key already? */
@ -575,10 +575,12 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
force_v4=0;
}
}
else if( node->pkt->pkttype == PKT_USER_ID ) {
else if( node->pkt->pkttype == PKT_USER_ID )
{
uidnode = (node->flag & NODFLG_MARK_A)? node : NULL;
if(uidnode)
{
int yesreally=0;
char *user=utf8_to_native(uidnode->pkt->pkt.user_id->name,
uidnode->pkt->pkt.user_id->len,
0);
@ -601,6 +603,8 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
uidnode->flag &= ~NODFLG_MARK_A;
uidnode=NULL;
}
else if(interactive)
yesreally=1;
}
else
{
@ -627,6 +631,8 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
uidnode->flag &= ~NODFLG_MARK_A;
uidnode=NULL;
}
else if(interactive)
yesreally=1;
}
else
{
@ -652,6 +658,8 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
uidnode->flag &= ~NODFLG_MARK_A;
uidnode=NULL;
}
else if(interactive)
yesreally=1;
}
else
{
@ -661,6 +669,17 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
}
}
if(uidnode && interactive && !yesreally)
{
tty_printf(_("User ID \"%s\" is signable. "),user);
if(!cpr_get_answer_is_yes("sign_uid.sign_okay",
_("Sign it? (y/N) ")))
{
uidnode->flag &= ~NODFLG_MARK_A;
uidnode=NULL;
}
}
m_free(user);
}
}
@ -1554,6 +1573,7 @@ keyedit_menu( const char *username, STRLIST locusr,
PKT_public_key *pk=keyblock->pkt->pkt.public_key;
tty_printf("\n");
if( redisplay && !quiet )
{
show_key_with_all_names( cur_keyblock, 0, 1, 0, 1, 0 );
@ -1683,7 +1703,7 @@ keyedit_menu( const char *username, STRLIST locusr,
case cmdSIGN: /* sign (only the public key) */
{
int localsig=0,nonrevokesig=0,trustsig=0;
int localsig=0,nonrevokesig=0,trustsig=0,interactive=0;
if( pk->is_revoked )
{
@ -1704,17 +1724,11 @@ keyedit_menu( const char *username, STRLIST locusr,
}
}
if( count_uids(keyblock) > 1 && !count_selected_uids(keyblock)
&& !have_commands )
{
if( !cpr_get_answer_is_yes("keyedit.sign_all.okay",
if(count_uids(keyblock) > 1 && !count_selected_uids(keyblock)
&& !cpr_get_answer_is_yes("keyedit.sign_all.okay",
_("Really sign all user IDs?"
" (y/N) ")))
{
tty_printf(_("Hint: Select the user IDs to sign\n"));
break;
}
}
interactive=1;
/* What sort of signing are we doing? */
if(!parse_sign_type(answer,&localsig,&nonrevokesig,&trustsig))
@ -1724,7 +1738,7 @@ keyedit_menu( const char *username, STRLIST locusr,
}
sign_uids(keyblock, locusr, &modified,
localsig, nonrevokesig, trustsig);
localsig, nonrevokesig, trustsig, interactive);
}
break;