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

gpg: Remove the edit-key toggle command.

* g10/keyedit.c (cmds): Remove helptext from "toggle".
(keyedit_menu): Remove "toggle" var and remove the sub/pub check
against toggle.
--

Because it is now easily possible to have only secret keys for some of
the main/subkeys the current check on whether any secret is available
is not really useful.  A finer grained check should eventually be
implemented.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-07-28 17:43:29 +02:00
parent 4bc75337f3
commit 7ef09afd1a
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1366,8 +1366,7 @@ static struct
N_("change the expiration date for the key or selected subkeys")}, N_("change the expiration date for the key or selected subkeys")},
{ "primary", cmdPRIMARY, KEYEDIT_NOT_SK | KEYEDIT_NEED_SK, { "primary", cmdPRIMARY, KEYEDIT_NOT_SK | KEYEDIT_NEED_SK,
N_("flag the selected user ID as primary")}, N_("flag the selected user ID as primary")},
{ "toggle", cmdTOGGLE, KEYEDIT_NEED_SK, { "toggle", cmdTOGGLE, KEYEDIT_NEED_SK, NULL}, /* Dummy command. */
N_("toggle between the secret and public key listings")},
{ "t", cmdTOGGLE, KEYEDIT_NEED_SK, NULL}, { "t", cmdTOGGLE, KEYEDIT_NEED_SK, NULL},
{ "pref", cmdPREF, KEYEDIT_NOT_SK, N_("list preferences (expert)")}, { "pref", cmdPREF, KEYEDIT_NOT_SK, N_("list preferences (expert)")},
{ "showpref", cmdSHOWPREF, KEYEDIT_NOT_SK, N_("list preferences (verbose)")}, { "showpref", cmdSHOWPREF, KEYEDIT_NOT_SK, N_("list preferences (verbose)")},
@ -1472,7 +1471,6 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
int modified = 0; int modified = 0;
int sec_shadowing = 0; int sec_shadowing = 0;
int run_subkey_warnings = 0; int run_subkey_warnings = 0;
int toggle;
int have_commands = !!commands; int have_commands = !!commands;
if (opt.command_fd != -1) if (opt.command_fd != -1)
@ -1515,8 +1513,6 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
tty_printf (_("Secret key is available.\n")); tty_printf (_("Secret key is available.\n"));
} }
toggle = 0;
/* Main command loop. */ /* Main command loop. */
for (;;) for (;;)
{ {
@ -1529,6 +1525,7 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
if (redisplay && !quiet) if (redisplay && !quiet)
{ {
/* Show using flags: with_revoker, with_subkeys. */
show_key_with_all_names (NULL, keyblock, 0, 1, 0, 1, 0, 0); show_key_with_all_names (NULL, keyblock, 0, 1, 0, 1, 0, 0);
tty_printf ("\n"); tty_printf ("\n");
redisplay = 0; redisplay = 0;
@ -1616,13 +1613,6 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
tty_printf (_("Need the secret key to do this.\n")); tty_printf (_("Need the secret key to do this.\n"));
cmd = cmdNOP; cmd = cmdNOP;
} }
else if (((cmds[i].flags & KEYEDIT_NOT_SK) && have_seckey && toggle)
|| ((cmds[i].flags & KEYEDIT_ONLY_SK) && have_seckey
&& !toggle))
{
tty_printf (_("Please use the command \"toggle\" first.\n"));
cmd = cmdNOP;
}
else else
cmd = cmds[i].id; cmd = cmds[i].id;
} }
@ -1743,7 +1733,6 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
where we worked with a secret and a public keyring. It where we worked with a secret and a public keyring. It
is not necessary anymore but we keep this command for the is not necessary anymore but we keep this command for the
sake of scripts using it. */ sake of scripts using it. */
toggle = !toggle;
redisplay = 1; redisplay = 1;
break; break;