1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-02-08 17:43:04 +01:00

Some minor bug fixes.

do not prompt for revocation reason for v3 revocations (unless
force-v4-certs is on) since they wouldn't be used anyway.

show the status of the sigs (exportable? revocable?) to the user before
prompting for which sig to revoke.  Also, make sure that local signatures
get local revocations.

Add "exec-path" variable to override PATH for execing programs.

properly check return code from classify_user_id to catch unclassifiable
keys.
This commit is contained in:
David Shaw 2002-03-05 04:57:10 +00:00
parent bbf4faae1a
commit 9267666d78
5 changed files with 64 additions and 17 deletions

View File

@ -1,3 +1,23 @@
2002-03-04 David Shaw <dshaw@jabberwocky.com>
* revoke.c (gen_revoke): do not prompt for revocation reason for
v3 revocations (unless force-v4-certs is on) since they wouldn't
be used anyway.
* keyedit.c (menu_revsig): show the status of the sigs
(exportable? revocable?) to the user before prompting for which
sig to revoke. Also, make sure that local signatures get local
revocations.
* keyedit.c (ask_revoke_sig): remind the user which sigs are
local.
* g10.c (main): Add "exec-path" variable to override PATH for
execing programs.
* export.c (do_export_stream): properly check return code from
classify_user_id to catch unclassifiable keys.
2002-03-03 David Shaw <dshaw@jabberwocky.com> 2002-03-03 David Shaw <dshaw@jabberwocky.com>
* parse-packet.c (parse_signature): variable type tweak for RISC * parse-packet.c (parse_signature): variable type tweak for RISC

View File

@ -135,8 +135,7 @@ do_export_stream( IOBUF out, STRLIST users, int secret, int onlyrfc, int *any )
desc = m_alloc ( ndesc * sizeof *desc); desc = m_alloc ( ndesc * sizeof *desc);
for (ndesc=0, sl=users; sl; sl = sl->next) { for (ndesc=0, sl=users; sl; sl = sl->next) {
classify_user_id (sl->d, desc+ndesc); if (classify_user_id (sl->d, desc+ndesc))
if (desc->mode)
ndesc++; ndesc++;
else else
log_error (_("key `%s' not found: %s\n"), log_error (_("key `%s' not found: %s\n"),

View File

@ -227,6 +227,7 @@ enum cmd_and_opt_values { aNull = 0,
oKeyServer, oKeyServer,
oKeyServerOptions, oKeyServerOptions,
oTempDir, oTempDir,
oExecPath,
oEncryptTo, oEncryptTo,
oNoEncryptTo, oNoEncryptTo,
oLoggerFD, oLoggerFD,
@ -345,6 +346,7 @@ static ARGPARSE_OPTS opts[] = {
N_("use the default key as default recipient")}, N_("use the default key as default recipient")},
{ oNoDefRecipient, "no-default-recipient", 0, "@" }, { oNoDefRecipient, "no-default-recipient", 0, "@" },
{ oTempDir, "temp-directory", 2, "@" }, { oTempDir, "temp-directory", 2, "@" },
{ oExecPath, "exec-path", 2, "@" },
{ oEncryptTo, "encrypt-to", 2, "@" }, { oEncryptTo, "encrypt-to", 2, "@" },
{ oNoEncryptTo, "no-encrypt-to", 0, "@" }, { oNoEncryptTo, "no-encrypt-to", 0, "@" },
{ oUser, "local-user",2, N_("use this user-id to sign or decrypt")}, { oUser, "local-user",2, N_("use this user-id to sign or decrypt")},
@ -1186,13 +1188,26 @@ main( int argc, char **argv )
#endif /* __riscos__ */ #endif /* __riscos__ */
break; break;
case oKeyServer: case oKeyServer:
if(parse_keyserver_uri(pargs.r.ret_str)) if(pargs.r.ret_str==NULL || parse_keyserver_uri(pargs.r.ret_str))
log_error(_("could not parse keyserver URI\n")); log_error(_("could not parse keyserver URI\n"));
break; break;
case oKeyServerOptions: case oKeyServerOptions:
if(pargs.r.ret_str)
parse_keyserver_options(pargs.r.ret_str); parse_keyserver_options(pargs.r.ret_str);
break; break;
case oTempDir: opt.temp_dir=pargs.r.ret_str; break; case oTempDir: opt.temp_dir=pargs.r.ret_str; break;
case oExecPath:
if(pargs.r.ret_str)
{
/* Notice that path is never freed. That is
intentional due to the way putenv() works. */
char *path=m_alloc(5+strlen(pargs.r.ret_str)+1);
strcpy(path,"PATH=");
strcat(path,pargs.r.ret_str);
if(putenv(path)!=0)
log_error(_("unable to set exec-path to %s\n"),path);
}
break;
case oNotation: add_notation_data( pargs.r.ret_str ); break; case oNotation: add_notation_data( pargs.r.ret_str ); break;
case oShowNotation: opt.show_notation=1; break; case oShowNotation: opt.show_notation=1; break;
case oNoShowNotation: opt.show_notation=0; break; case oNoShowNotation: opt.show_notation=0; break;

View File

@ -2328,8 +2328,13 @@ ask_revoke_sig( KBNODE keyblock, KBNODE node )
tty_printf(_("user ID: \"")); tty_printf(_("user ID: \""));
tty_print_utf8_string( unode->pkt->pkt.user_id->name, tty_print_utf8_string( unode->pkt->pkt.user_id->name,
unode->pkt->pkt.user_id->len ); unode->pkt->pkt.user_id->len );
if(sig->flags.exportable)
tty_printf(_("\"\nsigned with your key %08lX at %s\n"), tty_printf(_("\"\nsigned with your key %08lX at %s\n"),
(ulong)sig->keyid[1], datestr_from_sig(sig) ); (ulong)sig->keyid[1], datestr_from_sig(sig) );
else
tty_printf(_("\"\nlocally signed with your key %08lX at %s\n"),
(ulong)sig->keyid[1], datestr_from_sig(sig) );
if( cpr_get_answer_is_yes("ask_revoke_sig.one", if( cpr_get_answer_is_yes("ask_revoke_sig.one",
_("Create a revocation certificate for this signature? (y/N)")) ) { _("Create a revocation certificate for this signature? (y/N)")) ) {
@ -2370,9 +2375,10 @@ menu_revsig( KBNODE keyblock )
&& ((sig = node->pkt->pkt.signature), && ((sig = node->pkt->pkt.signature),
!seckey_available(sig->keyid) ) ) { !seckey_available(sig->keyid) ) ) {
if( (sig->sig_class&~3) == 0x10 ) { if( (sig->sig_class&~3) == 0x10 ) {
tty_printf(_(" signed by %08lX at %s%s\n"), tty_printf(_(" signed by %08lX at %s%s%s\n"),
(ulong)sig->keyid[1], datestr_from_sig(sig), (ulong)sig->keyid[1], datestr_from_sig(sig),
sig->flags.revocable?"":" (not revocable)"); sig->flags.exportable?"":" (non-exportable)",
sig->flags.revocable?"":" (non-revocable)");
if(sig->flags.revocable) if(sig->flags.revocable)
node->flag |= NODFLG_SELSIG; node->flag |= NODFLG_SELSIG;
} }
@ -2407,8 +2413,9 @@ menu_revsig( KBNODE keyblock )
} }
else if( node->pkt->pkttype == PKT_SIGNATURE ) { else if( node->pkt->pkttype == PKT_SIGNATURE ) {
sig = node->pkt->pkt.signature; sig = node->pkt->pkt.signature;
tty_printf(_(" signed by %08lX at %s\n"), tty_printf(_(" signed by %08lX at %s%s\n"),
(ulong)sig->keyid[1], datestr_from_sig(sig) ); (ulong)sig->keyid[1], datestr_from_sig(sig),
sig->flags.exportable?"":_(" (non-exportable)") );
} }
} }
if( !any ) if( !any )
@ -2440,6 +2447,7 @@ menu_revsig( KBNODE keyblock )
memset( &attrib, 0, sizeof attrib ); memset( &attrib, 0, sizeof attrib );
attrib.reason = reason; attrib.reason = reason;
attrib.non_exportable=!node->pkt->pkt.signature->flags.exportable;
node->flag &= ~NODFLG_MARK_A; node->flag &= ~NODFLG_MARK_A;
sk = m_alloc_secure_clear( sizeof *sk ); sk = m_alloc_secure_clear( sizeof *sk );

View File

@ -52,6 +52,9 @@ revocation_reason_build_cb( PKT_signature *sig, void *opaque )
byte *buffer; byte *buffer;
size_t buflen = 1; size_t buflen = 1;
if(!reason)
return 0;
if( reason->desc ) { if( reason->desc ) {
ud = native_to_utf8( reason->desc ); ud = native_to_utf8( reason->desc );
buflen += strlen(ud); buflen += strlen(ud);
@ -159,12 +162,14 @@ gen_revoke( const char *uname )
goto leave; goto leave;
} }
if(sk->version>=4 || opt.force_v4_certs) {
/* get the reason for the revocation */ /* get the reason for the revocation */
reason = ask_revocation_reason( 1, 0, 1 ); reason = ask_revocation_reason( 1, 0, 1 );
if( !reason ) { /* user decided to cancel */ if( !reason ) { /* user decided to cancel */
rc = 0; rc = 0;
goto leave; goto leave;
} }
}
switch( is_secret_key_protected( sk ) ) { switch( is_secret_key_protected( sk ) ) {
case -1: case -1:
@ -193,9 +198,9 @@ gen_revoke( const char *uname )
iobuf_push_filter( out, armor_filter, &afx ); iobuf_push_filter( out, armor_filter, &afx );
/* create it */ /* create it */
rc = make_keysig_packet( &sig, pk, NULL, NULL, sk, 0x20, 0, 0, 0, 0, rc = make_keysig_packet( &sig, pk, NULL, NULL, sk, 0x20, 0,
revocation_reason_build_cb, opt.force_v4_certs?4:0, 0, 0,
reason ); revocation_reason_build_cb, reason );
if( rc ) { if( rc ) {
log_error(_("make_keysig_packet failed: %s\n"), g10_errstr(rc)); log_error(_("make_keysig_packet failed: %s\n"), g10_errstr(rc));
goto leave; goto leave;