mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-01 16:33:02 +01:00
* keygen.c (keygen_set_std_prefs): Build the default preferences list at
runtime as it properly handles algorithms disabled at build or run time. * getkey.c (merge_selfsigs_main): Properly handle expired user IDs when the expired self-sig is not the only self-sig. * misc.c (compress_algo_to_string): Return NULL on failure like all of the other xxxx_algo_to_string() functions. * mainproc.c (list_node): Minor spacing tweak to match --list-keys output. * keylist.c (list_keyblock_print), mainproc.c (list_node): Mark revoked subkeys as revoked. Requested by Matthew Wilcox. Revoked overrides expiration when both apply. * keyedit.c (show_prefs): Use compress algo constants. (show_basic_key_info): Make revoked and expired tags translatable. * g10.c (rm_group): Properly ungroup from a list of groups.
This commit is contained in:
parent
74eadbf99b
commit
9842d84da0
@ -1,3 +1,27 @@
|
|||||||
|
2004-02-10 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* keygen.c (keygen_set_std_prefs): Build the default preferences
|
||||||
|
list at runtime as it properly handles algorithms disabled at
|
||||||
|
build or run time.
|
||||||
|
|
||||||
|
* getkey.c (merge_selfsigs_main): Properly handle expired user IDs
|
||||||
|
when the expired self-sig is not the only self-sig.
|
||||||
|
|
||||||
|
* misc.c (compress_algo_to_string): Return NULL on failure like
|
||||||
|
all of the other xxxx_algo_to_string() functions.
|
||||||
|
|
||||||
|
* mainproc.c (list_node): Minor spacing tweak to match --list-keys
|
||||||
|
output.
|
||||||
|
|
||||||
|
* keylist.c (list_keyblock_print), mainproc.c (list_node): Mark
|
||||||
|
revoked subkeys as revoked. Requested by Matthew Wilcox. Revoked
|
||||||
|
overrides expiration when both apply.
|
||||||
|
|
||||||
|
* keyedit.c (show_prefs): Use compress algo constants.
|
||||||
|
(show_basic_key_info): Make revoked and expired tags translatable.
|
||||||
|
|
||||||
|
* g10.c (rm_group): Properly ungroup from a list of groups.
|
||||||
|
|
||||||
2004-01-30 David Shaw <dshaw@jabberwocky.com>
|
2004-01-30 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* g10.c (main, rm_group): Add --ungroup command to remove a
|
* g10.c (main, rm_group): Add --ungroup command to remove a
|
||||||
|
@ -993,6 +993,7 @@ rm_group(char *name)
|
|||||||
|
|
||||||
free_strlist(item->values);
|
free_strlist(item->values);
|
||||||
m_free(item);
|
m_free(item);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
g10/getkey.c
18
g10/getkey.c
@ -1585,23 +1585,25 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
|
|||||||
* the same email address may become valid again (hired,
|
* the same email address may become valid again (hired,
|
||||||
* fired, hired again).
|
* fired, hired again).
|
||||||
*/
|
*/
|
||||||
if(sig->flags.expired) {
|
if(sig->flags.expired)
|
||||||
/* Expired uids don't get to be primary unless
|
{
|
||||||
they are the only uid there is. */
|
|
||||||
uidnode->pkt->pkt.user_id->is_primary=0;
|
|
||||||
uidnode->pkt->pkt.user_id->is_expired=1;
|
uidnode->pkt->pkt.user_id->is_expired=1;
|
||||||
uidnode->pkt->pkt.user_id->expiredate=sig->expiredate;
|
signode = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
sigdate = sig->timestamp;
|
{
|
||||||
|
uidnode->pkt->pkt.user_id->is_expired=0;
|
||||||
signode = k;
|
signode = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
sigdate = sig->timestamp;
|
||||||
|
uidnode->pkt->pkt.user_id->expiredate=sig->expiredate;
|
||||||
if( sig->version > sigversion )
|
if( sig->version > sigversion )
|
||||||
sigversion = sig->version;
|
sigversion = sig->version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if ( uidnode && signode ) {
|
if ( uidnode && signode ) {
|
||||||
fixup_uidnode ( uidnode, signode, keytimestamp );
|
fixup_uidnode ( uidnode, signode, keytimestamp );
|
||||||
pk->is_valid = 1;
|
pk->is_valid = 1;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* keyedit.c - keyedit stuff
|
/* keyedit.c - keyedit stuff
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002,
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
* 2003 Free Software Foundation, Inc.
|
* 2004 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -1788,7 +1788,7 @@ show_prefs (PKT_user_id *uid, int verbose)
|
|||||||
tty_printf ("%s", s );
|
tty_printf ("%s", s );
|
||||||
else
|
else
|
||||||
tty_printf ("[%d]", prefs[i].value);
|
tty_printf ("[%d]", prefs[i].value);
|
||||||
if (prefs[i].value == 0 )
|
if (prefs[i].value == COMPRESS_ALGO_NONE )
|
||||||
uncomp_seen = 1;
|
uncomp_seen = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1796,10 +1796,10 @@ show_prefs (PKT_user_id *uid, int verbose)
|
|||||||
if (any)
|
if (any)
|
||||||
tty_printf (", ");
|
tty_printf (", ");
|
||||||
else {
|
else {
|
||||||
tty_printf ("%s",compress_algo_to_string(1));
|
tty_printf ("%s",compress_algo_to_string(COMPRESS_ALGO_ZIP));
|
||||||
tty_printf (", ");
|
tty_printf (", ");
|
||||||
}
|
}
|
||||||
tty_printf ("%s",compress_algo_to_string(0));
|
tty_printf ("%s",compress_algo_to_string(COMPRESS_ALGO_NONE));
|
||||||
}
|
}
|
||||||
if(uid->mdc_feature || !uid->ks_modify)
|
if(uid->mdc_feature || !uid->ks_modify)
|
||||||
{
|
{
|
||||||
@ -2255,9 +2255,9 @@ show_basic_key_info ( KBNODE keyblock )
|
|||||||
|
|
||||||
tty_printf (" ");
|
tty_printf (" ");
|
||||||
if (uid->is_revoked)
|
if (uid->is_revoked)
|
||||||
tty_printf ("[revoked] ");
|
tty_printf (_("[revoked] "));
|
||||||
if ( uid->is_expired )
|
else if ( uid->is_expired )
|
||||||
tty_printf ("[expired] ");
|
tty_printf (_("[expired] "));
|
||||||
tty_print_utf8_string (uid->name, uid->len);
|
tty_print_utf8_string (uid->name, uid->len);
|
||||||
tty_printf ("\n");
|
tty_printf ("\n");
|
||||||
}
|
}
|
||||||
|
61
g10/keygen.c
61
g10/keygen.c
@ -1,6 +1,6 @@
|
|||||||
/* keygen.c - generate a key pair
|
/* keygen.c - generate a key pair
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
* Free Software Foundation, Inc.
|
* 2004 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -223,18 +223,6 @@ set_one_pref (int val, int type, const char *item, byte *buf, int *nbuf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_AES
|
|
||||||
#define AES "S9 S8 S7 "
|
|
||||||
#else
|
|
||||||
#define AES ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_CAST5
|
|
||||||
#define CAST5 "S3 "
|
|
||||||
#else
|
|
||||||
#define CAST5 ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse the supplied string and use it to set the standard
|
* Parse the supplied string and use it to set the standard
|
||||||
* preferences. The string may be in a form like the one printed by
|
* preferences. The string may be in a form like the one printed by
|
||||||
@ -248,22 +236,42 @@ keygen_set_std_prefs (const char *string,int personal)
|
|||||||
byte sym[MAX_PREFS], hash[MAX_PREFS], zip[MAX_PREFS];
|
byte sym[MAX_PREFS], hash[MAX_PREFS], zip[MAX_PREFS];
|
||||||
int nsym=0, nhash=0, nzip=0, val, rc=0;
|
int nsym=0, nhash=0, nzip=0, val, rc=0;
|
||||||
int mdc=1, modify=0; /* mdc defaults on, modify defaults off. */
|
int mdc=1, modify=0; /* mdc defaults on, modify defaults off. */
|
||||||
|
char dummy_string[45]; /* enough for 15 items */
|
||||||
|
|
||||||
if (!string || !ascii_strcasecmp (string, "default")) {
|
if (!string || !ascii_strcasecmp (string, "default"))
|
||||||
|
{
|
||||||
if (opt.def_preference_list)
|
if (opt.def_preference_list)
|
||||||
string=opt.def_preference_list;
|
string=opt.def_preference_list;
|
||||||
else if ( !check_cipher_algo(CIPHER_ALGO_IDEA) )
|
|
||||||
string = AES CAST5 "S2 S1 H2 H3 Z2 Z1";
|
|
||||||
else
|
else
|
||||||
string = AES CAST5 "S2 H2 H3 Z2 Z1";
|
{
|
||||||
|
dummy_string[0]='\0';
|
||||||
|
|
||||||
/* If we have it, IDEA goes *after* 3DES so it won't be used
|
/* Make sure we do not add more than 15 items here, as we
|
||||||
unless we're encrypting along with a V3 key. Ideally, we
|
could overflow the size of dummy_string. */
|
||||||
would only put the S1 preference in if the key was RSA and
|
if(!check_cipher_algo(CIPHER_ALGO_AES256))
|
||||||
<=2048 bits, as that is what won't break PGP2, but that is
|
strcat(dummy_string,"S9 ");
|
||||||
difficult with the current code, and not really worth
|
if(!check_cipher_algo(CIPHER_ALGO_AES192))
|
||||||
checking as a non-RSA <=2048 bit key wouldn't be usable by
|
strcat(dummy_string,"S8 ");
|
||||||
PGP2 anyway. -dms */
|
if(!check_cipher_algo(CIPHER_ALGO_AES))
|
||||||
|
strcat(dummy_string,"S7 ");
|
||||||
|
if(!check_cipher_algo(CIPHER_ALGO_CAST5))
|
||||||
|
strcat(dummy_string,"S3 ");
|
||||||
|
strcat(dummy_string,"S2 "); /* 3DES */
|
||||||
|
/* If we have it, IDEA goes *after* 3DES so it won't be
|
||||||
|
used unless we're encrypting along with a V3 key.
|
||||||
|
Ideally, we would only put the S1 preference in if the
|
||||||
|
key was RSA and <=2048 bits, as that is what won't
|
||||||
|
break PGP2, but that is difficult with the current
|
||||||
|
code, and not really worth checking as a non-RSA <=2048
|
||||||
|
bit key wouldn't be usable by PGP2 anyway. -dms */
|
||||||
|
if(!check_cipher_algo(CIPHER_ALGO_IDEA))
|
||||||
|
strcat(dummy_string,"S1 ");
|
||||||
|
|
||||||
|
/* SHA-1, RIPEMD160, ZLIB, ZIP */
|
||||||
|
strcat(dummy_string,"H2 H3 Z2 Z1");
|
||||||
|
|
||||||
|
string=dummy_string;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!ascii_strcasecmp (string, "none"))
|
else if (!ascii_strcasecmp (string, "none"))
|
||||||
string = "";
|
string = "";
|
||||||
@ -403,9 +411,6 @@ keygen_set_std_prefs (const char *string,int personal)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef CAST5
|
|
||||||
#undef AES
|
|
||||||
|
|
||||||
/* Return a fake user ID containing the preferences. Caller must
|
/* Return a fake user ID containing the preferences. Caller must
|
||||||
free. */
|
free. */
|
||||||
PKT_user_id *keygen_get_std_prefs(void)
|
PKT_user_id *keygen_get_std_prefs(void)
|
||||||
|
@ -750,7 +750,14 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
|
|||||||
else
|
else
|
||||||
printf("%08lX",(ulong)keyid2[1]);
|
printf("%08lX",(ulong)keyid2[1]);
|
||||||
printf(" %s",datestr_from_pk(pk2));
|
printf(" %s",datestr_from_pk(pk2));
|
||||||
if( pk2->expiredate )
|
/* Yes, this is an odd way to print the revoked string,
|
||||||
|
but we already have translations for "[revoked] " (with
|
||||||
|
the trailing space) and this is a simple way to take
|
||||||
|
advantage of it. In devel, this will be done rather
|
||||||
|
more elegantly. */
|
||||||
|
if( pk2->is_revoked )
|
||||||
|
printf(" %s",_("[revoked] "));
|
||||||
|
else if( pk2->expiredate )
|
||||||
printf(_(" [expires: %s]"), expirestr_from_pk( pk2 ) );
|
printf(_(" [expires: %s]"), expirestr_from_pk( pk2 ) );
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( fpr > 1 )
|
if( fpr > 1 )
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* mainproc.c - handle packets
|
/* mainproc.c - handle packets
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002,
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
* 2003 Free Software Foundation, Inc.
|
* 2004 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -866,12 +866,13 @@ list_node( CTX c, KBNODE node )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("%s %4u%c/%08lX %s ",
|
printf("%s %4u%c/%08lX %s%s",
|
||||||
mainkey? "pub":"sub",
|
mainkey? "pub":"sub",
|
||||||
nbits_from_pk( pk ),
|
nbits_from_pk( pk ),
|
||||||
pubkey_letter( pk->pubkey_algo ),
|
pubkey_letter( pk->pubkey_algo ),
|
||||||
(ulong)keyid_from_pk( pk, NULL ),
|
(ulong)keyid_from_pk( pk, NULL ),
|
||||||
datestr_from_pk( pk ) );
|
datestr_from_pk( pk ),
|
||||||
|
mainkey?" ":"");
|
||||||
|
|
||||||
if( mainkey ) {
|
if( mainkey ) {
|
||||||
/* and now list all userids with their signatures */
|
/* and now list all userids with their signatures */
|
||||||
@ -916,7 +917,12 @@ list_node( CTX c, KBNODE node )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pk->expiredate ) { /* of subkey */
|
else
|
||||||
|
{
|
||||||
|
/* of subkey */
|
||||||
|
if( pk->is_revoked )
|
||||||
|
printf(" %s",_("[revoked] "));
|
||||||
|
else if( pk->expiredate )
|
||||||
printf(_(" [expires: %s]"), expirestr_from_pk( pk ) );
|
printf(_(" [expires: %s]"), expirestr_from_pk( pk ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* misc.c - miscellaneous functions
|
/* misc.c - miscellaneous functions
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
|
* 2004 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -524,7 +525,7 @@ deprecated_warning(const char *configname,unsigned int configlineno,
|
|||||||
const char *
|
const char *
|
||||||
compress_algo_to_string(int algo)
|
compress_algo_to_string(int algo)
|
||||||
{
|
{
|
||||||
const char *s="?";
|
const char *s=NULL;
|
||||||
|
|
||||||
switch(algo)
|
switch(algo)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user