From c5fa20dba312d0c6596ecf83414a8e83d7dab584 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Sat, 14 May 2005 02:38:31 +0000 Subject: [PATCH] * build-packet.c (do_comment): Removed. (build_packet): Ignore comment packets. * export.c (do_export_stream): Don't export comment packets any longer. * options.h, g10.c (main): Remove --sk-comments and --no-sk-comments options, and replace with no-op. --- g10/ChangeLog | 11 +++++++++++ g10/build-packet.c | 45 +++++++++++++++++++-------------------------- g10/export.c | 12 +++++++----- g10/g10.c | 13 ++++--------- g10/options.h | 1 - 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index c9492c2c4..aa5843a64 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,14 @@ +2005-05-13 David Shaw + + * build-packet.c (do_comment): Removed. + (build_packet): Ignore comment packets. + + * export.c (do_export_stream): Don't export comment packets any + longer. + + * options.h, g10.c (main): Remove --sk-comments and + --no-sk-comments options, and replace with no-op. + 2005-05-11 David Shaw * keygen.c (write_selfsigs): Rename from write_selfsig. Write the diff --git a/g10/build-packet.c b/g10/build-packet.c index a7e03ae0b..e1aeae235 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -1,6 +1,6 @@ /* build-packet.c - assemble packets and write them - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, - * 2004 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, + * 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -34,8 +34,6 @@ #include "memory.h" #include "options.h" - -static int do_comment( IOBUF out, int ctb, PKT_comment *rem ); static int do_user_id( IOBUF out, int ctb, PKT_user_id *uid ); static int do_public_key( IOBUF out, int ctb, PKT_public_key *pk ); static int do_secret_key( IOBUF out, int ctb, PKT_secret_key *pk ); @@ -74,30 +72,38 @@ build_packet( IOBUF out, PACKET *pkt ) log_debug("build_packet() type=%d\n", pkt->pkttype ); assert( pkt->pkt.generic ); - switch( (pkttype = pkt->pkttype) ) { - case PKT_OLD_COMMENT: pkttype = pkt->pkttype = PKT_COMMENT; break; + switch( (pkttype = pkt->pkttype) ) + { case PKT_PLAINTEXT: new_ctb = pkt->pkt.plaintext->new_ctb; break; case PKT_ENCRYPTED: case PKT_ENCRYPTED_MDC: new_ctb = pkt->pkt.encrypted->new_ctb; break; case PKT_COMPRESSED:new_ctb = pkt->pkt.compressed->new_ctb; break; case PKT_USER_ID: - if( pkt->pkt.user_id->attrib_data ) - pkttype = PKT_ATTRIBUTE; - break; + if( pkt->pkt.user_id->attrib_data ) + pkttype = PKT_ATTRIBUTE; + break; default: break; - } + } if( new_ctb || pkttype > 15 ) /* new format */ ctb = 0xc0 | (pkttype & 0x3f); else ctb = 0x80 | ((pkttype & 15)<<2); - switch( pkttype ) { + switch( pkttype ) + { case PKT_ATTRIBUTE: case PKT_USER_ID: rc = do_user_id( out, ctb, pkt->pkt.user_id ); break; + case PKT_OLD_COMMENT: case PKT_COMMENT: - rc = do_comment( out, ctb, pkt->pkt.comment ); + /* + Ignore these. Theoretically, this will never be called as + we have no way to output comment packets any longer, but + just in case there is some code path that would end up + outputting a comment that was written before comments were + dropped (in the public key?) this is a no-op. + */ break; case PKT_PUBLIC_SUBKEY: case PKT_PUBLIC_KEY: @@ -137,7 +143,7 @@ build_packet( IOBUF out, PACKET *pkt ) default: log_bug("invalid packet type in build_packet()\n"); break; - } + } return rc; } @@ -190,19 +196,6 @@ write_fake_data( IOBUF out, MPI a ) } } - -static int -do_comment( IOBUF out, int ctb, PKT_comment *rem ) -{ - if( opt.sk_comments ) - { - write_header2(out, ctb, rem->len, 2); - if( iobuf_write( out, rem->data, rem->len ) ) - return G10ERR_WRITE_FILE; - } - return 0; -} - static int do_user_id( IOBUF out, int ctb, PKT_user_id *uid ) { diff --git a/g10/export.c b/g10/export.c index 73aa750e9..b91c0442e 100644 --- a/g10/export.c +++ b/g10/export.c @@ -240,10 +240,11 @@ do_export_stream( IOBUF out, STRLIST users, int secret, continue; } - /* don't export any comment packets but those in the - * secret keyring */ - if( !secret && node->pkt->pkttype == PKT_COMMENT ) - continue; + /* We used to use comment packets, but not any longer. In + case we still have comments on a key, strip them here + before we call build_packet(). */ + if( node->pkt->pkttype == PKT_COMMENT ) + continue; /* make sure that ring_trust packets never get exported */ if (node->pkt->pkttype == PKT_RING_TRUST) @@ -335,7 +336,8 @@ do_export_stream( IOBUF out, STRLIST users, int secret, || node->pkt->pkt.signature->keyid[1]!=keyid[1])) continue; - /* do not export packets which are marked as not exportable */ + /* do not export packets which are marked as not + exportable */ if(!(options&EXPORT_LOCAL_SIGS) && !node->pkt->pkt.signature->flags.exportable) continue; /* not exportable */ diff --git a/g10/g10.c b/g10/g10.c index 10d9b4dc0..44a7f33c0 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -187,8 +187,6 @@ enum cmd_and_opt_values oStatusFile, oAttributeFD, oAttributeFile, - oSKComments, - oNoSKComments, oEmitVersion, oNoEmitVersion, oCompletesNeeded, @@ -347,6 +345,7 @@ enum cmd_and_opt_values oEnableProgressFilter, oMultifile, oKeyidFormat, + oNoop, oReaderPort, octapiDriver, @@ -496,8 +495,8 @@ static ARGPARSE_OPTS opts[] = { { oStatusFile, "status-file" ,2, "@"}, { oAttributeFD, "attribute-fd" ,1, "@" }, { oAttributeFile, "attribute-file" ,2, "@" }, - { oNoSKComments, "no-sk-comments", 0, "@"}, - { oSKComments, "sk-comments", 0, "@"}, + { oNoop, "sk-comments", 0, "@"}, + { oNoop, "no-sk-comments", 0, "@"}, { oCompletesNeeded, "completes-needed", 1, "@"}, { oMarginalsNeeded, "marginals-needed", 1, "@"}, { oMaxCertDepth, "max-cert-depth", 1, "@" }, @@ -2030,8 +2029,6 @@ main( int argc, char **argv ) case oNoVerbose: g10_opt_verbose = 0; opt.verbose = 0; opt.list_sigs=0; break; case oQuickRandom: quick_random_gen(1); break; - case oSKComments: opt.sk_comments=1; break; - case oNoSKComments: opt.sk_comments=0; break; case oEmitVersion: opt.no_version=0; break; case oNoEmitVersion: opt.no_version=1; break; case oCompletesNeeded: opt.completes_needed = pargs.r.ret_int; break; @@ -2544,6 +2541,7 @@ main( int argc, char **argv ) else log_error("unknown keyid-format `%s'\n",pargs.r.ret_str); break; + case oNoop: break; default : pargs.err = configfp? 1:2; break; } @@ -2705,7 +2703,6 @@ main( int argc, char **argv ) else { opt.force_v4_certs = 0; - opt.sk_comments = 0; opt.escape_from = 1; opt.force_v3_sigs = 1; opt.pgp2_workarounds = 1; @@ -2720,14 +2717,12 @@ main( int argc, char **argv ) } else if(PGP6) { - opt.sk_comments=0; opt.escape_from=1; opt.force_v3_sigs=1; opt.ask_sig_expire=0; } else if(PGP7) { - opt.sk_comments=0; opt.escape_from=1; opt.force_v3_sigs=1; opt.ask_sig_expire=0; diff --git a/g10/options.h b/g10/options.h index 294dec8bc..deedc561b 100644 --- a/g10/options.h +++ b/g10/options.h @@ -80,7 +80,6 @@ struct int def_cert_level; int min_cert_level; int ask_cert_level; - int sk_comments; int no_version; int marginals_needed; int completes_needed;