gnupg/g10 (ChangeLog build-packet.c export.c g10.c options.h)

cvs user dshaw cvs at cvs.gnupg.org
Sat May 14 04:19:20 CEST 2005


    Date: Saturday, May 14, 2005 @ 04:38:31
  Author: dshaw
    Path: /cvs/gnupg/gnupg/g10

Modified: ChangeLog build-packet.c export.c g10.c options.h

* 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.


----------------+
 ChangeLog      |   11 +++++++++++
 build-packet.c |   45 +++++++++++++++++++--------------------------
 export.c       |   12 +++++++-----
 g10.c          |   13 ++++---------
 options.h      |    1 -
 5 files changed, 41 insertions(+), 41 deletions(-)


Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.735 gnupg/g10/ChangeLog:1.736
--- gnupg/g10/ChangeLog:1.735	Wed May 11 21:31:53 2005
+++ gnupg/g10/ChangeLog	Sat May 14 04:38:31 2005
@@ -1,3 +1,14 @@
+2005-05-13  David Shaw  <dshaw at 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 at jabberwocky.com>
 
 	* keygen.c (write_selfsigs): Rename from write_selfsig.  Write the
Index: gnupg/g10/build-packet.c
diff -u gnupg/g10/build-packet.c:1.90 gnupg/g10/build-packet.c:1.91
--- gnupg/g10/build-packet.c:1.90	Wed Dec 22 18:49:44 2004
+++ gnupg/g10/build-packet.c	Sat May 14 04:38:31 2005
@@ -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 @@
 	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 @@
       default:
 	log_bug("invalid packet type in build_packet()\n");
 	break;
-    }
+      }
 
     return rc;
 }
@@ -190,19 +196,6 @@
     }
 }
 
-
-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 )
 {
Index: gnupg/g10/export.c
diff -u gnupg/g10/export.c:1.45 gnupg/g10/export.c:1.46
--- gnupg/g10/export.c:1.45	Sat Jan  1 22:21:11 2005
+++ gnupg/g10/export.c	Sat May 14 04:38:31 2005
@@ -240,10 +240,11 @@
 		  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 @@
 		       || 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 */
Index: gnupg/g10/g10.c
diff -u gnupg/g10/g10.c:1.303 gnupg/g10/g10.c:1.304
--- gnupg/g10/g10.c:1.303	Fri May  6 21:25:19 2005
+++ gnupg/g10/g10.c	Sat May 14 04:38:31 2005
@@ -187,8 +187,6 @@
     oStatusFile,
     oAttributeFD,
     oAttributeFile,
-    oSKComments,
-    oNoSKComments,
     oEmitVersion,
     oNoEmitVersion,
     oCompletesNeeded,
@@ -347,6 +345,7 @@
     oEnableProgressFilter,
     oMultifile,
     oKeyidFormat,
+    oNoop,
 
     oReaderPort,
     octapiDriver,
@@ -496,8 +495,8 @@
     { 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 @@
 	  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 @@
 	    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 @@
 	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 @@
       }
     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;
Index: gnupg/g10/options.h
diff -u gnupg/g10/options.h:1.137 gnupg/g10/options.h:1.138
--- gnupg/g10/options.h:1.137	Fri May  6 00:08:37 2005
+++ gnupg/g10/options.h	Sat May 14 04:38:31 2005
@@ -80,7 +80,6 @@
   int def_cert_level;
   int min_cert_level;
   int ask_cert_level;
-  int sk_comments;
   int no_version;
   int marginals_needed;
   int completes_needed;




More information about the Gnupg-commits mailing list