1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-02 22:38:02 +02:00

gpg: Fix --desig-revoke.

* g10/revoke.c (gen_desig_revoke): Add additional parameter ctrl.
Check that the secret key is available.  If not, display an error
message.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Regression-due-to: 8459bcf9
This commit is contained in:
Neal H. Walfield 2015-10-19 15:04:45 +02:00
parent a608ee750d
commit c37621166e
3 changed files with 14 additions and 11 deletions

View File

@ -4179,11 +4179,11 @@ main (int argc, char **argv)
break; break;
case aDesigRevoke: case aDesigRevoke:
if( argc != 1 ) if (argc != 1)
wrong_args("--desig-revoke user-id"); wrong_args ("--desig-revoke user-id");
username = make_username(*argv); username = make_username (*argv);
gen_desig_revoke( username, locusr ); gen_desig_revoke (ctrl, username, locusr);
xfree( username ); xfree (username);
break; break;
case aDeArmor: case aDeArmor:

View File

@ -356,7 +356,7 @@ int enarmor_file( const char *fname );
struct revocation_reason_info; struct revocation_reason_info;
int gen_standard_revoke (PKT_public_key *psk, const char *cache_nonce); int gen_standard_revoke (PKT_public_key *psk, const char *cache_nonce);
int gen_revoke( const char *uname ); int gen_revoke( const char *uname );
int gen_desig_revoke( const char *uname, strlist_t locusr); int gen_desig_revoke (ctrl_t ctrl, const char *uname, strlist_t locusr);
int revocation_reason_build_cb( PKT_signature *sig, void *opaque ); int revocation_reason_build_cb( PKT_signature *sig, void *opaque );
struct revocation_reason_info * struct revocation_reason_info *
ask_revocation_reason( int key_rev, int cert_rev, int hint ); ask_revocation_reason( int key_rev, int cert_rev, int hint );

View File

@ -195,7 +195,7 @@ export_minimal_pk(IOBUF out,KBNODE keyblock,
* Generate a revocation certificate for UNAME via a designated revoker * Generate a revocation certificate for UNAME via a designated revoker
*/ */
int int
gen_desig_revoke( const char *uname, strlist_t locusr ) gen_desig_revoke (ctrl_t ctrl, const char *uname, strlist_t locusr)
{ {
int rc = 0; int rc = 0;
armor_filter_context_t *afx; armor_filter_context_t *afx;
@ -312,6 +312,13 @@ gen_desig_revoke( const char *uname, strlist_t locusr )
tty_printf(_("(This is a sensitive revocation key)\n")); tty_printf(_("(This is a sensitive revocation key)\n"));
tty_printf("\n"); tty_printf("\n");
rc = agent_probe_secret_key (ctrl, pk2);
if (rc)
{
tty_printf (_("Secret key is not available.\n"));
continue;
}
if( !cpr_get_answer_is_yes("gen_desig_revoke.okay", if( !cpr_get_answer_is_yes("gen_desig_revoke.okay",
_("Create a designated revocation certificate for this key? (y/N) "))) _("Create a designated revocation certificate for this key? (y/N) ")))
continue; continue;
@ -321,10 +328,6 @@ gen_desig_revoke( const char *uname, strlist_t locusr )
if( !reason ) if( !reason )
continue; continue;
rc = -1;/*FIXME: check_secret_key (pk2, 0 );*/
if (rc)
continue;
if( !opt.armor ) if( !opt.armor )
tty_printf(_("ASCII armored output forced.\n")); tty_printf(_("ASCII armored output forced.\n"));