From 07250279e7ec1086ca224fcc96c4a639c0fc2df6 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Mon, 20 Dec 2004 05:19:09 +0000 Subject: [PATCH] * 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 "\t\r\n" or just "\r\n" before canonicalizing text line endings. Default to "\t\r\n". --- g10/ChangeLog | 13 +++++++++++++ g10/g10.c | 16 ++++++++++++---- g10/getkey.c | 2 +- g10/keyedit.c | 30 ++++++++++++++++-------------- g10/keygen.c | 2 +- g10/options.h | 3 ++- g10/passphrase.c | 4 ++-- g10/textfilter.c | 23 ++++++++++++++--------- 8 files changed, 61 insertions(+), 32 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index bd9b6e795..b2b395da1 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,16 @@ +2004-12-20 David Shaw + + * 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 "\t\r\n" or + just "\r\n" before canonicalizing text line endings. Default to + "\t\r\n". + 2004-12-19 David Shaw * keygen.c (keygen_get_std_prefs): Set reference count when diff --git a/g10/g10.c b/g10/g10.c index eb66ad5e9..3919f6850 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -201,6 +201,8 @@ enum cmd_and_opt_values oPGP6, oPGP7, oPGP8, + oRFC2440Text, + oNoRFC2440Text, oCipherAlgo, oDigestAlgo, oCertDigestAlgo, @@ -507,6 +509,8 @@ static ARGPARSE_OPTS opts[] = { { oPGP6, "pgp6", 0, "@"}, { oPGP7, "pgp7", 0, "@"}, { oPGP8, "pgp8", 0, "@"}, + { oRFC2440Text, "rfc2440-text", 0, "@"}, + { oNoRFC2440Text, "no-rfc2440-text", 0, "@"}, { oS2KMode, "s2k-mode", 1, "@"}, { oS2KDigest, "s2k-digest-algo", 2, "@"}, { oS2KCipher, "s2k-cipher-algo", 2, "@"}, @@ -1668,6 +1672,7 @@ main( int argc, char **argv ) opt.min_cert_level=2; set_screen_dimensions(); opt.keyid_format=KF_SHORT; + opt.rfc2440_text=1; #if defined (_WIN32) set_homedir ( read_w32_registry_string( NULL, "Software\\GNU\\GnuPG", "HomeDir" )); @@ -2090,17 +2095,18 @@ main( int argc, char **argv ) opt.force_v4_certs = 0; opt.escape_from = 1; break; - case oRFC2440: case oOpenPGP: - /* TODO: When 2440bis becomes a RFC, these may need - changing. */ + case oRFC2440: + /* TODO: When 2440bis becomes a RFC, set new values for + oOpenPGP. */ + opt.rfc2440_text=1; opt.compliance = CO_RFC2440; opt.allow_non_selfsigned_uid = 1; opt.allow_freeform_uid = 1; opt.pgp2_workarounds = 0; opt.escape_from = 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.not_dash_escaped = 0; opt.def_cipher_algo = 0; @@ -2117,6 +2123,8 @@ main( int argc, char **argv ) case oPGP8: opt.compliance = CO_PGP8; break; case oGnuPG: opt.compliance = CO_GNUPG; break; case oCompressSigs: opt.compress_sigs = 1; break; + case oRFC2440Text: opt.rfc2440_text=1; break; + case oNoRFC2440Text: opt.rfc2440_text=0; break; case oRunAsShmCP: #ifndef __riscos__ # ifndef USE_SHM_COPROCESSING diff --git a/g10/getkey.c b/g10/getkey.c index 2e6ac432c..86c1cfba2 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -2417,7 +2417,7 @@ finish_lookup (GETKEY_CTX ctx) { char *tempkeystr= 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)); m_free(tempkeystr); } diff --git a/g10/keyedit.c b/g10/keyedit.c index 46274b1b9..433bb9cad 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -1292,31 +1292,31 @@ keyedit_menu( const char *username, STRLIST locusr, { "list" , cmdLIST , 0, N_("list key and user IDs") }, { "l" , cmdLIST , 0, NULL }, { "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") }, { "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 }, /* "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 menu. */ - { "lsign" , cmdNOP , 0, N_("sign the key locally") }, + { "lsign" , cmdNOP , 0, N_("sign selected user IDs locally") }, { "debug" , cmdDEBUG , 0, NULL }, { "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") }, { "deluid" , cmdDELUID , KEYEDIT_NOT_SK, N_("delete user ID") }, /* delphoto is really deluid in disguise */ { "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 { "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")}, #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") }, { "delsig" , cmdDELSIG , KEYEDIT_NOT_SK, N_("delete signatures") }, - { "expire" , cmdEXPIRE , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("change the expire date") }, - { "primary" , cmdPRIMARY , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("flag user ID as primary")}, + { "expire" , cmdEXPIRE , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("change the expiration date") }, + { "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") }, { "t" , cmdTOGGLE , KEYEDIT_NEED_SK, NULL }, { "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 }, { "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") }, + /* Alias */ + { "password", cmdPASSWD , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, NULL }, { "trust" , cmdTRUST , KEYEDIT_NOT_SK, N_("change the ownertrust") }, { "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 */ { "revphoto", cmdREVUID , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, NULL }, - { "revkey" , cmdREVKEY , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("revoke a secondary key") }, - { "disable" , cmdDISABLEKEY, KEYEDIT_NOT_SK, N_("disable a key") }, - { "enable" , cmdENABLEKEY , KEYEDIT_NOT_SK, N_("enable a key") }, + { "revkey" , cmdREVKEY , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("revoke selected subkeys") }, + { "disable" , cmdDISABLEKEY, KEYEDIT_NOT_SK, N_("disable key") }, + { "enable" , cmdENABLEKEY , KEYEDIT_NOT_SK, N_("enable key") }, { "showphoto",cmdSHOWPHOTO , 0, N_("show photo ID") }, { NULL, cmdNONE, 0, NULL } }; @@ -3136,11 +3138,11 @@ menu_expire( KBNODE pub_keyblock, KBNODE sec_keyblock ) n1 = count_selected_keys( pub_keyblock ); if( n1 > 1 ) { - tty_printf(_("Please select at most one secondary key.\n")); + tty_printf(_("Please select at most one subkey.\n")); return 0; } else if( n1 ) - tty_printf(_("Changing expiration time for a secondary key.\n")); + tty_printf(_("Changing expiration time for a subkey.\n")); else { tty_printf(_("Changing expiration time for the primary key.\n")); @@ -3683,7 +3685,7 @@ menu_select_key( KBNODE keyblock, int idx ) } } if( !node ) { - tty_printf(_("No secondary key with index %d\n"), idx ); + tty_printf(_("No subkey with index %d\n"), idx ); return 0; } } diff --git a/g10/keygen.c b/g10/keygen.c index b511c96be..5ca727dce 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -2952,7 +2952,7 @@ do_generate_keypair( struct para_data_s *para, tty_printf(_("Note that this key cannot be used for " "encryption. You may want to use\n" "the command \"--edit-key\" to generate a " - "secondary key for this purpose.\n") ); + "subkey for this purpose.\n") ); } } } diff --git a/g10/options.h b/g10/options.h index e8463f0e8..668b71f7b 100644 --- a/g10/options.h +++ b/g10/options.h @@ -187,11 +187,12 @@ struct int no_homedir_creation; struct groupitem *grouplist; int strict; - int mangle_dos_filenames; + int mangle_dos_filenames; int enable_progress_filter; unsigned int screen_columns; unsigned int screen_lines; byte *show_subpackets; + int rfc2440_text; #ifdef ENABLE_CARD_SUPPORT const char *ctapi_driver; /* Library to access the ctAPI. */ diff --git a/g10/passphrase.c b/g10/passphrase.c index 1a477288d..e4bf37959 100644 --- a/g10/passphrase.c +++ b/g10/passphrase.c @@ -30,8 +30,8 @@ #include #include #endif -#if defined (_WIN32) || defined (__CYGWIN32__) -# include +#if defined (_WIN32) +#include #endif #include #ifdef HAVE_LOCALE_H diff --git a/g10/textfilter.c b/g10/textfilter.c index 833cf64d3..a029b727c 100644 --- a/g10/textfilter.c +++ b/g10/textfilter.c @@ -97,15 +97,20 @@ standard( text_filter_context_t *tfx, IOBUF a, /* The story behind this is that 2440 says that textmode hashes should canonicalize line endings to CRLF and remove spaces and tabs. 2440bis-12 says to just canonicalize to - CRLF. So, we default to the 2440bis-12 behavior, but - revert to the strict 2440 behavior if the user specifies - --rfc2440. In practical terms this makes no difference to - any signatures in the real world except for a textmode - detached signature. PGP always used the 2440bis-12 (1991) - behavior (ignoring 2440 itself), so this actually makes us - compatible with PGP textmode detached signatures for the - first time. */ - if(RFC2440) + CRLF. 1.4.0 was released using the bis-12 behavior, but it + was discovered that many mail clients do not canonicalize + PGP/MIME signature text appropriately (and were relying on + GnuPG to handle trailing spaces). So, we default to the + 2440 behavior, but use the 2440bis-12 behavior if the user + specifies --no-rfc2440-text. The default will be changed + at some point in the future when the mail clients have been + upgraded. Aside from PGP/MIME and broken mail clients, + 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, " \t\r\n"); else