1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

* 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.
This commit is contained in:
David Shaw 2005-05-14 02:38:31 +00:00
parent e81d88b265
commit c5fa20dba3
5 changed files with 41 additions and 41 deletions

View File

@ -1,3 +1,14 @@
2005-05-13 David Shaw <dshaw@jabberwocky.com>
* 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 <dshaw@jabberwocky.com> 2005-05-11 David Shaw <dshaw@jabberwocky.com>
* keygen.c (write_selfsigs): Rename from write_selfsig. Write the * keygen.c (write_selfsigs): Rename from write_selfsig. Write the

View File

@ -1,6 +1,6 @@
/* build-packet.c - assemble packets and write them /* build-packet.c - assemble packets and write them
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
* 2004 Free Software Foundation, Inc. * 2005 Free Software Foundation, Inc.
* *
* This file is part of GnuPG. * This file is part of GnuPG.
* *
@ -34,8 +34,6 @@
#include "memory.h" #include "memory.h"
#include "options.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_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_public_key( IOBUF out, int ctb, PKT_public_key *pk );
static int do_secret_key( IOBUF out, int ctb, PKT_secret_key *pk ); static int do_secret_key( IOBUF out, int ctb, PKT_secret_key *pk );
@ -74,8 +72,8 @@ build_packet( IOBUF out, PACKET *pkt )
log_debug("build_packet() type=%d\n", pkt->pkttype ); log_debug("build_packet() type=%d\n", pkt->pkttype );
assert( pkt->pkt.generic ); assert( pkt->pkt.generic );
switch( (pkttype = pkt->pkttype) ) { switch( (pkttype = pkt->pkttype) )
case PKT_OLD_COMMENT: pkttype = pkt->pkttype = PKT_COMMENT; break; {
case PKT_PLAINTEXT: new_ctb = pkt->pkt.plaintext->new_ctb; break; case PKT_PLAINTEXT: new_ctb = pkt->pkt.plaintext->new_ctb; break;
case PKT_ENCRYPTED: case PKT_ENCRYPTED:
case PKT_ENCRYPTED_MDC: new_ctb = pkt->pkt.encrypted->new_ctb; break; case PKT_ENCRYPTED_MDC: new_ctb = pkt->pkt.encrypted->new_ctb; break;
@ -91,13 +89,21 @@ build_packet( IOBUF out, PACKET *pkt )
ctb = 0xc0 | (pkttype & 0x3f); ctb = 0xc0 | (pkttype & 0x3f);
else else
ctb = 0x80 | ((pkttype & 15)<<2); ctb = 0x80 | ((pkttype & 15)<<2);
switch( pkttype ) { switch( pkttype )
{
case PKT_ATTRIBUTE: case PKT_ATTRIBUTE:
case PKT_USER_ID: case PKT_USER_ID:
rc = do_user_id( out, ctb, pkt->pkt.user_id ); rc = do_user_id( out, ctb, pkt->pkt.user_id );
break; break;
case PKT_OLD_COMMENT:
case PKT_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; break;
case PKT_PUBLIC_SUBKEY: case PKT_PUBLIC_SUBKEY:
case PKT_PUBLIC_KEY: case PKT_PUBLIC_KEY:
@ -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 static int
do_user_id( IOBUF out, int ctb, PKT_user_id *uid ) do_user_id( IOBUF out, int ctb, PKT_user_id *uid )
{ {

View File

@ -240,9 +240,10 @@ do_export_stream( IOBUF out, STRLIST users, int secret,
continue; continue;
} }
/* don't export any comment packets but those in the /* We used to use comment packets, but not any longer. In
* secret keyring */ case we still have comments on a key, strip them here
if( !secret && node->pkt->pkttype == PKT_COMMENT ) before we call build_packet(). */
if( node->pkt->pkttype == PKT_COMMENT )
continue; continue;
/* make sure that ring_trust packets never get exported */ /* make sure that ring_trust packets never get exported */
@ -335,7 +336,8 @@ do_export_stream( IOBUF out, STRLIST users, int secret,
|| node->pkt->pkt.signature->keyid[1]!=keyid[1])) || node->pkt->pkt.signature->keyid[1]!=keyid[1]))
continue; 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) if(!(options&EXPORT_LOCAL_SIGS)
&& !node->pkt->pkt.signature->flags.exportable) && !node->pkt->pkt.signature->flags.exportable)
continue; /* not exportable */ continue; /* not exportable */

View File

@ -187,8 +187,6 @@ enum cmd_and_opt_values
oStatusFile, oStatusFile,
oAttributeFD, oAttributeFD,
oAttributeFile, oAttributeFile,
oSKComments,
oNoSKComments,
oEmitVersion, oEmitVersion,
oNoEmitVersion, oNoEmitVersion,
oCompletesNeeded, oCompletesNeeded,
@ -347,6 +345,7 @@ enum cmd_and_opt_values
oEnableProgressFilter, oEnableProgressFilter,
oMultifile, oMultifile,
oKeyidFormat, oKeyidFormat,
oNoop,
oReaderPort, oReaderPort,
octapiDriver, octapiDriver,
@ -496,8 +495,8 @@ static ARGPARSE_OPTS opts[] = {
{ oStatusFile, "status-file" ,2, "@"}, { oStatusFile, "status-file" ,2, "@"},
{ oAttributeFD, "attribute-fd" ,1, "@" }, { oAttributeFD, "attribute-fd" ,1, "@" },
{ oAttributeFile, "attribute-file" ,2, "@" }, { oAttributeFile, "attribute-file" ,2, "@" },
{ oNoSKComments, "no-sk-comments", 0, "@"}, { oNoop, "sk-comments", 0, "@"},
{ oSKComments, "sk-comments", 0, "@"}, { oNoop, "no-sk-comments", 0, "@"},
{ oCompletesNeeded, "completes-needed", 1, "@"}, { oCompletesNeeded, "completes-needed", 1, "@"},
{ oMarginalsNeeded, "marginals-needed", 1, "@"}, { oMarginalsNeeded, "marginals-needed", 1, "@"},
{ oMaxCertDepth, "max-cert-depth", 1, "@" }, { oMaxCertDepth, "max-cert-depth", 1, "@" },
@ -2030,8 +2029,6 @@ main( int argc, char **argv )
case oNoVerbose: g10_opt_verbose = 0; case oNoVerbose: g10_opt_verbose = 0;
opt.verbose = 0; opt.list_sigs=0; break; opt.verbose = 0; opt.list_sigs=0; break;
case oQuickRandom: quick_random_gen(1); 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 oEmitVersion: opt.no_version=0; break;
case oNoEmitVersion: opt.no_version=1; break; case oNoEmitVersion: opt.no_version=1; break;
case oCompletesNeeded: opt.completes_needed = pargs.r.ret_int; break; case oCompletesNeeded: opt.completes_needed = pargs.r.ret_int; break;
@ -2544,6 +2541,7 @@ main( int argc, char **argv )
else else
log_error("unknown keyid-format `%s'\n",pargs.r.ret_str); log_error("unknown keyid-format `%s'\n",pargs.r.ret_str);
break; break;
case oNoop: break;
default : pargs.err = configfp? 1:2; break; default : pargs.err = configfp? 1:2; break;
} }
@ -2705,7 +2703,6 @@ main( int argc, char **argv )
else else
{ {
opt.force_v4_certs = 0; opt.force_v4_certs = 0;
opt.sk_comments = 0;
opt.escape_from = 1; opt.escape_from = 1;
opt.force_v3_sigs = 1; opt.force_v3_sigs = 1;
opt.pgp2_workarounds = 1; opt.pgp2_workarounds = 1;
@ -2720,14 +2717,12 @@ main( int argc, char **argv )
} }
else if(PGP6) else if(PGP6)
{ {
opt.sk_comments=0;
opt.escape_from=1; opt.escape_from=1;
opt.force_v3_sigs=1; opt.force_v3_sigs=1;
opt.ask_sig_expire=0; opt.ask_sig_expire=0;
} }
else if(PGP7) else if(PGP7)
{ {
opt.sk_comments=0;
opt.escape_from=1; opt.escape_from=1;
opt.force_v3_sigs=1; opt.force_v3_sigs=1;
opt.ask_sig_expire=0; opt.ask_sig_expire=0;

View File

@ -80,7 +80,6 @@ struct
int def_cert_level; int def_cert_level;
int min_cert_level; int min_cert_level;
int ask_cert_level; int ask_cert_level;
int sk_comments;
int no_version; int no_version;
int marginals_needed; int marginals_needed;
int completes_needed; int completes_needed;