gnupg/g10 (ChangeLog export.c g10.c options.h)

cvs user dshaw cvs at cvs.gnupg.org
Wed Jun 8 05:10:05 CEST 2005


    Date: Wednesday, June 8, 2005 @ 05:31:48
  Author: dshaw
    Path: /cvs/gnupg/gnupg/g10

Modified: ChangeLog export.c g10.c options.h

* options.h, g10.c (main), export.c (parse_export_options,
do_export_stream): Add export-options export-clean-sigs,
export-clean-uids, export-clean-subkeys, and export-clean which is all
of the above.  Export-minimal is the same except it also removes all
non-selfsigs.  export-unusable-sigs is now a noop.


-----------+
 ChangeLog |    8 ++++++++
 export.c  |   53 +++++++++++++++++++++++++++++++++--------------------
 g10.c     |    4 ++--
 options.h |    4 +++-
 4 files changed, 46 insertions(+), 23 deletions(-)


Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.749 gnupg/g10/ChangeLog:1.750
--- gnupg/g10/ChangeLog:1.749	Wed Jun  1 21:13:05 2005
+++ gnupg/g10/ChangeLog	Wed Jun  8 05:31:47 2005
@@ -1,3 +1,11 @@
+2005-06-07  David Shaw  <dshaw at jabberwocky.com>
+
+	* options.h, g10.c (main), export.c (parse_export_options,
+	do_export_stream): Add export-options export-clean-sigs,
+	export-clean-uids, export-clean-subkeys, and export-clean which is
+	all of the above.  Export-minimal is the same except it also
+	removes all non-selfsigs.  export-unusable-sigs is now a noop.
+
 2005-06-01  David Shaw  <dshaw at jabberwocky.com>
 
 	* signal.c [HAVE_DOSISH_SYSTEM]: Fix unused function warnings on
Index: gnupg/g10/export.c
diff -u gnupg/g10/export.c:1.47 gnupg/g10/export.c:1.48
--- gnupg/g10/export.c:1.47	Tue May 31 10:39:17 2005
+++ gnupg/g10/export.c	Wed Jun  8 05:31:48 2005
@@ -1,6 +1,6 @@
 /* export.c
- * 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.
  *
@@ -35,6 +35,7 @@
 #include "util.h"
 #include "main.h"
 #include "i18n.h"
+#include "trustdb.h"
 
 static int do_export( STRLIST users, int secret, unsigned int options );
 static int do_export_stream( IOBUF out, STRLIST users, int secret,
@@ -49,12 +50,20 @@
       {"export-local-sigs",EXPORT_LOCAL_SIGS,NULL},
       {"export-attributes",EXPORT_ATTRIBUTES,NULL},
       {"export-sensitive-revkeys",EXPORT_SENSITIVE_REVKEYS,NULL},
-      {"export-minimal",EXPORT_MINIMAL,NULL},
-      {"export-unusable-sigs",EXPORT_UNUSABLE_SIGS,NULL},
+      {"export-minimal",
+       EXPORT_MINIMAL|EXPORT_CLEAN_SIGS|EXPORT_CLEAN_UIDS|EXPORT_CLEAN_SUBKEYS,
+       NULL},
+      {"export-clean",
+       EXPORT_CLEAN_SIGS|EXPORT_CLEAN_UIDS|EXPORT_CLEAN_SUBKEYS,NULL},
+      {"export-clean-sigs",EXPORT_CLEAN_SIGS,NULL},
+      {"export-clean-uids",EXPORT_CLEAN_UIDS,NULL},
+      {"export-clean-subkeys",EXPORT_CLEAN_SUBKEYS,NULL},
       /* Aliases for backward compatibility */
       {"include-local-sigs",EXPORT_LOCAL_SIGS,NULL},
       {"include-attributes",EXPORT_ATTRIBUTES,NULL},
       {"include-sensitive-revkeys",EXPORT_SENSITIVE_REVKEYS,NULL},
+      /* dummy */
+      {"export-unusable-sigs",0,NULL},
       {NULL,0,NULL}
       /* add tags for include revoked and disabled? */
     };
@@ -222,13 +231,20 @@
 			 keystr(sk_keyid));
 		continue;
 	      }
+	  }
+	else
+	  {
+	    /* It's a public key export */
+	    if((options&EXPORT_MINIMAL)
+	       && (node=find_kbnode(keyblock,PKT_PUBLIC_KEY)))
+	      keyid_from_pk(node->pkt->pkt.public_key,keyid);
+
+	    if(options&EXPORT_CLEAN_UIDS)
+	      clean_uids_from_key(keyblock,opt.verbose);
 
-	    if(options&EXPORT_MINIMAL)
-	      keyid_from_sk(sk,keyid);
+	    if(options&EXPORT_CLEAN_SUBKEYS)
+	      clean_subkeys_from_key(keyblock,opt.verbose);
 	  }
-	else if((options&EXPORT_MINIMAL)
-		&& (node=find_kbnode(keyblock,PKT_PUBLIC_KEY)))
-	  keyid_from_pk(node->pkt->pkt.public_key,keyid);
 
 	/* and write it */
 	for( kbctx=NULL; (node = walk_kbnode( keyblock, &kbctx, 0 )); ) {
@@ -315,7 +331,14 @@
 		  continue;
 	      }
 
-	    if( node->pkt->pkttype == PKT_SIGNATURE )
+	    if(node->pkt->pkttype==PKT_USER_ID)
+	      {
+		/* Run clean_sigs_from_uid against each uid if
+		   export-clean-sigs is on. */
+		if(options&EXPORT_CLEAN_SIGS)
+		  clean_sigs_from_uid(keyblock,node,opt.verbose);
+	      }
+	    else if(node->pkt->pkttype==PKT_SIGNATURE)
 	      {
 		/* If we have export-minimal turned on, do not include
 		   any signature that isn't a selfsig.  Note that this
@@ -327,16 +350,6 @@
 		       || node->pkt->pkt.signature->keyid[1]!=keyid[1]))
 		  continue;
 
-		/* We do basically the same thing for
-		   export-unusable-sigs.  It only applies to expired
-		   uid sigs that aren't selfsigs. */
-		if(!(options&EXPORT_UNUSABLE_SIGS)
-		   && IS_UID_SIG(node->pkt->pkt.signature)
-		   && node->pkt->pkt.signature->flags.expired
-		   && (node->pkt->pkt.signature->keyid[0]!=keyid[0]
-		       || node->pkt->pkt.signature->keyid[1]!=keyid[1]))
-		  continue;
-
 		/* do not export packets which are marked as not
 		   exportable */
 		if(!(options&EXPORT_LOCAL_SIGS)
Index: gnupg/g10/g10.c
diff -u gnupg/g10/g10.c:1.309 gnupg/g10/g10.c:1.310
--- gnupg/g10/g10.c:1.309	Tue May 31 10:39:16 2005
+++ gnupg/g10/g10.c	Wed Jun  8 05:31:48 2005
@@ -1664,9 +1664,9 @@
     opt.force_v3_sigs = 1;
     opt.escape_from = 1;
     opt.import_options=IMPORT_SK2PK;
-    opt.export_options=EXPORT_ATTRIBUTES|EXPORT_UNUSABLE_SIGS;
+    opt.export_options=EXPORT_ATTRIBUTES;
     opt.keyserver_options.import_options=IMPORT_REPAIR_PKS_SUBKEY_BUG;
-    opt.keyserver_options.export_options=EXPORT_ATTRIBUTES|EXPORT_UNUSABLE_SIGS;
+    opt.keyserver_options.export_options=EXPORT_ATTRIBUTES;
     opt.keyserver_options.options=
       KEYSERVER_INCLUDE_SUBKEYS|KEYSERVER_INCLUDE_REVOKED|KEYSERVER_TRY_DNS_SRV|KEYSERVER_HONOR_KEYSERVER_URL;
     opt.verify_options=
Index: gnupg/g10/options.h
diff -u gnupg/g10/options.h:1.139 gnupg/g10/options.h:1.140
--- gnupg/g10/options.h:1.139	Tue May 31 10:39:16 2005
+++ gnupg/g10/options.h	Wed Jun  8 05:31:48 2005
@@ -257,7 +257,9 @@
 #define EXPORT_ATTRIBUTES                (1<<1)
 #define EXPORT_SENSITIVE_REVKEYS         (1<<2)
 #define EXPORT_MINIMAL                   (1<<3)
-#define EXPORT_UNUSABLE_SIGS             (1<<4)
+#define EXPORT_CLEAN_SIGS                (1<<4)
+#define EXPORT_CLEAN_UIDS                (1<<5)
+#define EXPORT_CLEAN_SUBKEYS             (1<<6)
 
 #define LIST_SHOW_PHOTOS                 (1<<0)
 #define LIST_SHOW_POLICY_URLS            (1<<1)




More information about the Gnupg-commits mailing list