1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-05 12:31:50 +01:00

* keyedit.c (keyedit_menu): Invisible alias "passwd" as "password".

* passphrase.c: Don't check for __CYGWIN__, so it is treated as a
unix-like system.

* options.h, g10.c (main), textfilter.c (standard): Use new option
--rfc2440-text to determine whether to filter "<space>\t\r\n" or just
"\r\n" before canonicalizing text line endings.  Default to
"<space>\t\r\n".
This commit is contained in:
David Shaw 2004-12-20 05:19:09 +00:00
parent 1e487ab1d6
commit 07250279e7
8 changed files with 61 additions and 32 deletions

View File

@ -1,3 +1,16 @@
2004-12-20 David Shaw <dshaw@jabberwocky.com>
* keyedit.c (keyedit_menu): Invisible alias "passwd" as
"password".
* passphrase.c: Don't check for __CYGWIN__, so it is treated as a
unix-like system.
* options.h, g10.c (main), textfilter.c (standard): Use new option
--rfc2440-text to determine whether to filter "<space>\t\r\n" or
just "\r\n" before canonicalizing text line endings. Default to
"<space>\t\r\n".
2004-12-19 David Shaw <dshaw@jabberwocky.com> 2004-12-19 David Shaw <dshaw@jabberwocky.com>
* keygen.c (keygen_get_std_prefs): Set reference count when * keygen.c (keygen_get_std_prefs): Set reference count when

View File

@ -201,6 +201,8 @@ enum cmd_and_opt_values
oPGP6, oPGP6,
oPGP7, oPGP7,
oPGP8, oPGP8,
oRFC2440Text,
oNoRFC2440Text,
oCipherAlgo, oCipherAlgo,
oDigestAlgo, oDigestAlgo,
oCertDigestAlgo, oCertDigestAlgo,
@ -507,6 +509,8 @@ static ARGPARSE_OPTS opts[] = {
{ oPGP6, "pgp6", 0, "@"}, { oPGP6, "pgp6", 0, "@"},
{ oPGP7, "pgp7", 0, "@"}, { oPGP7, "pgp7", 0, "@"},
{ oPGP8, "pgp8", 0, "@"}, { oPGP8, "pgp8", 0, "@"},
{ oRFC2440Text, "rfc2440-text", 0, "@"},
{ oNoRFC2440Text, "no-rfc2440-text", 0, "@"},
{ oS2KMode, "s2k-mode", 1, "@"}, { oS2KMode, "s2k-mode", 1, "@"},
{ oS2KDigest, "s2k-digest-algo", 2, "@"}, { oS2KDigest, "s2k-digest-algo", 2, "@"},
{ oS2KCipher, "s2k-cipher-algo", 2, "@"}, { oS2KCipher, "s2k-cipher-algo", 2, "@"},
@ -1668,6 +1672,7 @@ main( int argc, char **argv )
opt.min_cert_level=2; opt.min_cert_level=2;
set_screen_dimensions(); set_screen_dimensions();
opt.keyid_format=KF_SHORT; opt.keyid_format=KF_SHORT;
opt.rfc2440_text=1;
#if defined (_WIN32) #if defined (_WIN32)
set_homedir ( read_w32_registry_string( NULL, set_homedir ( read_w32_registry_string( NULL,
"Software\\GNU\\GnuPG", "HomeDir" )); "Software\\GNU\\GnuPG", "HomeDir" ));
@ -2090,17 +2095,18 @@ main( int argc, char **argv )
opt.force_v4_certs = 0; opt.force_v4_certs = 0;
opt.escape_from = 1; opt.escape_from = 1;
break; break;
case oRFC2440:
case oOpenPGP: case oOpenPGP:
/* TODO: When 2440bis becomes a RFC, these may need case oRFC2440:
changing. */ /* TODO: When 2440bis becomes a RFC, set new values for
oOpenPGP. */
opt.rfc2440_text=1;
opt.compliance = CO_RFC2440; opt.compliance = CO_RFC2440;
opt.allow_non_selfsigned_uid = 1; opt.allow_non_selfsigned_uid = 1;
opt.allow_freeform_uid = 1; opt.allow_freeform_uid = 1;
opt.pgp2_workarounds = 0; opt.pgp2_workarounds = 0;
opt.escape_from = 0; opt.escape_from = 0;
opt.force_v3_sigs = 0; opt.force_v3_sigs = 0;
opt.compress_keys = 0; /* not mandated but we do it */ opt.compress_keys = 0; /* not mandated, but we do it */
opt.compress_sigs = 0; /* ditto. */ opt.compress_sigs = 0; /* ditto. */
opt.not_dash_escaped = 0; opt.not_dash_escaped = 0;
opt.def_cipher_algo = 0; opt.def_cipher_algo = 0;
@ -2117,6 +2123,8 @@ main( int argc, char **argv )
case oPGP8: opt.compliance = CO_PGP8; break; case oPGP8: opt.compliance = CO_PGP8; break;
case oGnuPG: opt.compliance = CO_GNUPG; break; case oGnuPG: opt.compliance = CO_GNUPG; break;
case oCompressSigs: opt.compress_sigs = 1; break; case oCompressSigs: opt.compress_sigs = 1; break;
case oRFC2440Text: opt.rfc2440_text=1; break;
case oNoRFC2440Text: opt.rfc2440_text=0; break;
case oRunAsShmCP: case oRunAsShmCP:
#ifndef __riscos__ #ifndef __riscos__
# ifndef USE_SHM_COPROCESSING # ifndef USE_SHM_COPROCESSING

View File

@ -2417,7 +2417,7 @@ finish_lookup (GETKEY_CTX ctx)
{ {
char *tempkeystr= char *tempkeystr=
m_strdup(keystr_from_pk(latest_key->pkt->pkt.public_key)); m_strdup(keystr_from_pk(latest_key->pkt->pkt.public_key));
log_info(_("using secondary key %s instead of primary key %s\n"), log_info(_("using subkey %s instead of primary key %s\n"),
tempkeystr, keystr_from_pk(keyblock->pkt->pkt.public_key)); tempkeystr, keystr_from_pk(keyblock->pkt->pkt.public_key));
m_free(tempkeystr); m_free(tempkeystr);
} }

View File

@ -1292,31 +1292,31 @@ keyedit_menu( const char *username, STRLIST locusr,
{ "list" , cmdLIST , 0, N_("list key and user IDs") }, { "list" , cmdLIST , 0, N_("list key and user IDs") },
{ "l" , cmdLIST , 0, NULL }, { "l" , cmdLIST , 0, NULL },
{ "uid" , cmdSELUID , 0, N_("select user ID N") }, { "uid" , cmdSELUID , 0, N_("select user ID N") },
{ "key" , cmdSELKEY , 0, N_("select secondary key N") }, { "key" , cmdSELKEY , 0, N_("select subkey N") },
{ "check" , cmdCHECK , 0, N_("list signatures") }, { "check" , cmdCHECK , 0, N_("list signatures") },
{ "c" , cmdCHECK , 0, NULL }, { "c" , cmdCHECK , 0, NULL },
{ "sign" , cmdSIGN , KEYEDIT_NOT_SK|KEYEDIT_TAIL_MATCH, N_("sign the key") }, { "sign" , cmdSIGN , KEYEDIT_NOT_SK|KEYEDIT_TAIL_MATCH, N_("sign selected user IDs") },
{ "s" , cmdSIGN , KEYEDIT_NOT_SK, NULL }, { "s" , cmdSIGN , KEYEDIT_NOT_SK, NULL },
/* "lsign" will never match since "sign" comes first and it is a /* "lsign" will never match since "sign" comes first and it is a
tail match. It is just here so it shows up in the help tail match. It is just here so it shows up in the help
menu. */ menu. */
{ "lsign" , cmdNOP , 0, N_("sign the key locally") }, { "lsign" , cmdNOP , 0, N_("sign selected user IDs locally") },
{ "debug" , cmdDEBUG , 0, NULL }, { "debug" , cmdDEBUG , 0, NULL },
{ "adduid" , cmdADDUID , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("add a user ID") }, { "adduid" , cmdADDUID , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("add a user ID") },
{ "addphoto", cmdADDPHOTO , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("add a photo ID") }, { "addphoto", cmdADDPHOTO , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("add a photo ID") },
{ "deluid" , cmdDELUID , KEYEDIT_NOT_SK, N_("delete user ID") }, { "deluid" , cmdDELUID , KEYEDIT_NOT_SK, N_("delete user ID") },
/* delphoto is really deluid in disguise */ /* delphoto is really deluid in disguise */
{ "delphoto", cmdDELUID , KEYEDIT_NOT_SK, NULL }, { "delphoto", cmdDELUID , KEYEDIT_NOT_SK, NULL },
{ "addkey" , cmdADDKEY , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("add a secondary key") }, { "addkey" , cmdADDKEY , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("add a subkey") },
#ifdef ENABLE_CARD_SUPPORT #ifdef ENABLE_CARD_SUPPORT
{ "addcardkey", cmdADDCARDKEY , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("add a key to a smartcard") }, { "addcardkey", cmdADDCARDKEY , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("add a key to a smartcard") },
{ "keytocard", cmdKEYTOCARD , KEYEDIT_NEED_SK|KEYEDIT_ONLY_SK, N_("move a key to a smartcard")}, { "keytocard", cmdKEYTOCARD , KEYEDIT_NEED_SK|KEYEDIT_ONLY_SK, N_("move a key to a smartcard")},
#endif /*ENABLE_CARD_SUPPORT*/ #endif /*ENABLE_CARD_SUPPORT*/
{ "delkey" , cmdDELKEY , KEYEDIT_NOT_SK, N_("delete a secondary key") }, { "delkey" , cmdDELKEY , KEYEDIT_NOT_SK, N_("delete selected subkeys") },
{ "addrevoker",cmdADDREVOKER,KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("add a revocation key") }, { "addrevoker",cmdADDREVOKER,KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("add a revocation key") },
{ "delsig" , cmdDELSIG , KEYEDIT_NOT_SK, N_("delete signatures") }, { "delsig" , cmdDELSIG , KEYEDIT_NOT_SK, N_("delete signatures") },
{ "expire" , cmdEXPIRE , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("change the expire date") }, { "expire" , cmdEXPIRE , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("change the expiration date") },
{ "primary" , cmdPRIMARY , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("flag user ID as primary")}, { "primary" , cmdPRIMARY , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("flag a user ID as primary")},
{ "toggle" , cmdTOGGLE , KEYEDIT_NEED_SK, N_("toggle between secret and public key listing") }, { "toggle" , cmdTOGGLE , KEYEDIT_NEED_SK, N_("toggle between secret and public key listing") },
{ "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)")},
@ -1326,14 +1326,16 @@ keyedit_menu( const char *username, STRLIST locusr,
{ "updpref" , cmdSETPREF , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, NULL }, { "updpref" , cmdSETPREF , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, NULL },
{ "keyserver",cmdPREFKS , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("set preferred keyserver URL")}, { "keyserver",cmdPREFKS , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("set preferred keyserver URL")},
{ "passwd" , cmdPASSWD , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("change the passphrase") }, { "passwd" , cmdPASSWD , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("change the passphrase") },
/* Alias */
{ "password", cmdPASSWD , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, NULL },
{ "trust" , cmdTRUST , KEYEDIT_NOT_SK, N_("change the ownertrust") }, { "trust" , cmdTRUST , KEYEDIT_NOT_SK, N_("change the ownertrust") },
{ "revsig" , cmdREVSIG , KEYEDIT_NOT_SK, N_("revoke signatures") }, { "revsig" , cmdREVSIG , KEYEDIT_NOT_SK, N_("revoke signatures") },
{ "revuid" , cmdREVUID , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("revoke a user ID") }, { "revuid" , cmdREVUID , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("revoke selected user IDs") },
/* Alias */ /* Alias */
{ "revphoto", cmdREVUID , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, NULL }, { "revphoto", cmdREVUID , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, NULL },
{ "revkey" , cmdREVKEY , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("revoke a secondary key") }, { "revkey" , cmdREVKEY , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("revoke selected subkeys") },
{ "disable" , cmdDISABLEKEY, KEYEDIT_NOT_SK, N_("disable a key") }, { "disable" , cmdDISABLEKEY, KEYEDIT_NOT_SK, N_("disable key") },
{ "enable" , cmdENABLEKEY , KEYEDIT_NOT_SK, N_("enable a key") }, { "enable" , cmdENABLEKEY , KEYEDIT_NOT_SK, N_("enable key") },
{ "showphoto",cmdSHOWPHOTO , 0, N_("show photo ID") }, { "showphoto",cmdSHOWPHOTO , 0, N_("show photo ID") },
{ NULL, cmdNONE, 0, NULL } { NULL, cmdNONE, 0, NULL }
}; };
@ -3136,11 +3138,11 @@ menu_expire( KBNODE pub_keyblock, KBNODE sec_keyblock )
n1 = count_selected_keys( pub_keyblock ); n1 = count_selected_keys( pub_keyblock );
if( n1 > 1 ) { if( n1 > 1 ) {
tty_printf(_("Please select at most one secondary key.\n")); tty_printf(_("Please select at most one subkey.\n"));
return 0; return 0;
} }
else if( n1 ) else if( n1 )
tty_printf(_("Changing expiration time for a secondary key.\n")); tty_printf(_("Changing expiration time for a subkey.\n"));
else else
{ {
tty_printf(_("Changing expiration time for the primary key.\n")); tty_printf(_("Changing expiration time for the primary key.\n"));
@ -3683,7 +3685,7 @@ menu_select_key( KBNODE keyblock, int idx )
} }
} }
if( !node ) { if( !node ) {
tty_printf(_("No secondary key with index %d\n"), idx ); tty_printf(_("No subkey with index %d\n"), idx );
return 0; return 0;
} }
} }

View File

@ -2952,7 +2952,7 @@ do_generate_keypair( struct para_data_s *para,
tty_printf(_("Note that this key cannot be used for " tty_printf(_("Note that this key cannot be used for "
"encryption. You may want to use\n" "encryption. You may want to use\n"
"the command \"--edit-key\" to generate a " "the command \"--edit-key\" to generate a "
"secondary key for this purpose.\n") ); "subkey for this purpose.\n") );
} }
} }
} }

View File

@ -192,6 +192,7 @@ struct
unsigned int screen_columns; unsigned int screen_columns;
unsigned int screen_lines; unsigned int screen_lines;
byte *show_subpackets; byte *show_subpackets;
int rfc2440_text;
#ifdef ENABLE_CARD_SUPPORT #ifdef ENABLE_CARD_SUPPORT
const char *ctapi_driver; /* Library to access the ctAPI. */ const char *ctapi_driver; /* Library to access the ctAPI. */

View File

@ -30,8 +30,8 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#endif #endif
#if defined (_WIN32) || defined (__CYGWIN32__) #if defined (_WIN32)
# include <windows.h> #include <windows.h>
#endif #endif
#include <errno.h> #include <errno.h>
#ifdef HAVE_LOCALE_H #ifdef HAVE_LOCALE_H

View File

@ -97,15 +97,20 @@ standard( text_filter_context_t *tfx, IOBUF a,
/* The story behind this is that 2440 says that textmode /* The story behind this is that 2440 says that textmode
hashes should canonicalize line endings to CRLF and remove hashes should canonicalize line endings to CRLF and remove
spaces and tabs. 2440bis-12 says to just canonicalize to spaces and tabs. 2440bis-12 says to just canonicalize to
CRLF. So, we default to the 2440bis-12 behavior, but CRLF. 1.4.0 was released using the bis-12 behavior, but it
revert to the strict 2440 behavior if the user specifies was discovered that many mail clients do not canonicalize
--rfc2440. In practical terms this makes no difference to PGP/MIME signature text appropriately (and were relying on
any signatures in the real world except for a textmode GnuPG to handle trailing spaces). So, we default to the
detached signature. PGP always used the 2440bis-12 (1991) 2440 behavior, but use the 2440bis-12 behavior if the user
behavior (ignoring 2440 itself), so this actually makes us specifies --no-rfc2440-text. The default will be changed
compatible with PGP textmode detached signatures for the at some point in the future when the mail clients have been
first time. */ upgraded. Aside from PGP/MIME and broken mail clients,
if(RFC2440) this makes no difference to any signatures in the real
world except for a textmode detached signature. PGP always
used the 2440bis-12 behavior (ignoring 2440 itself), so
this actually makes us compatible with PGP textmode
detached signatures for the first time. */
if(opt.rfc2440_text)
tfx->buffer_len=trim_trailing_chars(tfx->buffer,tfx->buffer_len, tfx->buffer_len=trim_trailing_chars(tfx->buffer,tfx->buffer_len,
" \t\r\n"); " \t\r\n");
else else