From f41be729cca2e53ab9b652daa999cbacbb470bc6 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Sun, 24 Nov 2002 01:44:37 +0000 Subject: [PATCH] * g10.c (add_notation_data): Disallow notation names that do not contain a '@', unless --expert is set. This is to help prevent people from polluting the (as yet unused) IETF namespace. * main.h: Comments about default algorithms. * photoid.c (image_type_to_string): Comments about 3-letter file extensions. * g10.c (main): Add --strict and --no-strict as no-ops to smooth transition when the devel GnuPG becomes the stable one. --- g10/ChangeLog | 14 ++++++++++++++ g10/g10.c | 31 +++++++++++++++++++++++++++---- g10/main.h | 4 +++- g10/photoid.c | 7 ++++--- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 8dbb60211..6184c5422 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,17 @@ +2002-11-23 David Shaw + + * g10.c (add_notation_data): Disallow notation names that do not + contain a '@', unless --expert is set. This is to help prevent + people from polluting the (as yet unused) IETF namespace. + + * main.h: Comments about default algorithms. + + * photoid.c (image_type_to_string): Comments about 3-letter + file extensions. + + * g10.c (main): Add --strict and --no-strict as no-ops to smooth + transition when the devel GnuPG becomes the stable one. + 2002-11-13 Stefan Bellon * getkey.c (get_pubkey_byfprint_fast): Fixed type incompatibility, diff --git a/g10/g10.c b/g10/g10.c index edb5a8fc4..6f088b4ae 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -300,6 +300,8 @@ enum cmd_and_opt_values { aNull = 0, oLCctype, oLCmessages, oGroup, + oStrict, + oNoStrict, aTest }; @@ -589,6 +591,8 @@ static ARGPARSE_OPTS opts[] = { { oLCctype, "lc-ctype", 2, "@" }, { oLCmessages, "lc-messages", 2, "@" }, { oGroup, "group", 2, "@" }, + { oStrict, "strict", 0, "@" }, + { oNoStrict, "no-strict", 0, "@" }, {0} }; @@ -1673,6 +1677,8 @@ main( int argc, char **argv ) case oLCctype: opt.lc_ctype = pargs.r.ret_str; break; case oLCmessages: opt.lc_messages = pargs.r.ret_str; break; case oGroup: add_group(pargs.r.ret_str); break; + case oStrict: /* noop */ break; + case oNoStrict: /* noop */ break; default : pargs.err = configfp? 1:2; break; } } @@ -2699,6 +2705,7 @@ add_notation_data( const char *string, int which ) STRLIST sl,*notation_data; int critical=0; int highbit=0; + int saw_at=0; if(which) notation_data=&opt.cert_notation_data; @@ -2710,13 +2717,29 @@ add_notation_data( const char *string, int which ) string++; } - for( s=string ; *s != '='; s++ ) { - if( !*s || (*s & 0x80) || (!isgraph(*s) && !isspace(*s)) ) { + /* If and when the IETF assigns some official name tags, we'll + have to add them here. */ + + for( s=string ; *s != '='; s++ ) + { + if( *s=='@') + saw_at=0; + + if( !*s || (*s & 0x80) || (!isgraph(*s) && !isspace(*s)) ) + { log_error(_("a notation name must have only printable characters " "or spaces, and end with an '='\n") ); return; - } - } + } + } + + if(!saw_at && !opt.expert) + { + log_error( + _("a user notation name must contain the '@' character\n")); + return; + } + /* we only support printable text - therefore we enforce the use * of only printable characters (an empty value is valid) */ for( s++; *s ; s++ ) { diff --git a/g10/main.h b/g10/main.h index 4282a47c2..466d74a1f 100644 --- a/g10/main.h +++ b/g10/main.h @@ -25,8 +25,10 @@ #include "cipher.h" #include "keydb.h" +/* It could be argued that the default cipher should be 3DES rather + than CAST5, and the default compression should be 0 + (i.e. uncompressed) rather than 1 (zip). */ #define DEFAULT_CIPHER_ALGO CIPHER_ALGO_CAST5 -#define DEFAULT_PUBKEY_ALGO PUBKEY_ALGO_ELGAMAL #define DEFAULT_DIGEST_ALGO DIGEST_ALGO_SHA1 #define DEFAULT_COMPRESS_ALGO 1 diff --git a/g10/photoid.c b/g10/photoid.c index c20e20eca..fe74e8fb7 100644 --- a/g10/photoid.c +++ b/g10/photoid.c @@ -189,8 +189,9 @@ int parse_image_header(const struct user_attribute *attr,byte *type,u32 *len) /* style==0 for extension, 1 for name, 2 for MIME type. Remember that the "name" style string could be used in a user ID name field, so - make sure it is not too big (see - parse-packet.c:parse_attribute). */ + make sure it is not too big (see parse-packet.c:parse_attribute). + Extensions should be 3 characters long for the best cross-platform + compatibility. */ char *image_type_to_string(byte type,int style) { char *string; @@ -288,7 +289,7 @@ void show_photos(const struct user_attribute *attrs, /* Make the filename. Notice we are not using the image encoding type for more than cosmetics. Most external image viewers can handle a multitude of types, and even if one - cannot understand a partcular type, we have no way to know + cannot understand a particular type, we have no way to know which. The spec permits this, by the way. -dms */ #ifdef USE_ONLY_8DOT3