* keyedit.c (keyedit_menu, menu_clean_sigs_from_uids): Add "minimize"
authorDavid Shaw <dshaw@jabberwocky.com>
Thu, 10 Nov 2005 23:25:20 +0000 (23:25 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Thu, 10 Nov 2005 23:25:20 +0000 (23:25 +0000)
command.

g10/ChangeLog
g10/keyedit.c
g10/trustdb.c

index 617598c..459e78e 100644 (file)
@@ -1,5 +1,8 @@
 2005-11-10  David Shaw  <dshaw@jabberwocky.com>
 
+       * keyedit.c (keyedit_menu, menu_clean_sigs_from_uids): Add
+       "minimize" command.
+
        * packet.h, keyedit.c (menu_clean_uids_from_key), trustdb.c
        (clean_uids_from_key): Fix display bug where sigs cleaned for
        other reasons caused a uid to appear as if it had been compacted.
@@ -13,8 +16,8 @@
        * trustdb.h, trustdb.c (clean_sigs_from_uid): Add flag to remove
        all non-selfsigs from key during cleaning.  Change all callers.
 
-       * export.c (do_export_stream): Use it here so we don't need
-       additional minimize code in the export path.
+       * export.c (do_export_stream): Use it here for export-minimal so
+       we don't need additional minimize code in the export path.
 
 2005-11-06  David Shaw  <dshaw@jabberwocky.com>
 
index f28f924..b331052 100644 (file)
@@ -57,7 +57,7 @@ static int menu_adduid( KBNODE keyblock, KBNODE sec_keyblock,
                        int photo, const char *photo_name );
 static void menu_deluid( KBNODE pub_keyblock, KBNODE sec_keyblock );
 static int menu_delsig( KBNODE pub_keyblock );
-static int menu_clean_sigs_from_uids(KBNODE keyblock);
+static int menu_clean_sigs_from_uids(KBNODE keyblock,int self_only);
 static int menu_clean_uids_from_key(KBNODE keyblock);
 static void menu_delkey( KBNODE pub_keyblock, KBNODE sec_keyblock );
 static int menu_addrevoker( KBNODE pub_keyblock,
@@ -1341,7 +1341,7 @@ enum cmdids
     cmdADDREVOKER, cmdTOGGLE, cmdSELKEY, cmdPASSWD, cmdTRUST, cmdPREF,
     cmdEXPIRE, cmdBACKSIGN, cmdENABLEKEY, cmdDISABLEKEY, cmdSHOWPREF,
     cmdSETPREF, cmdPREFKS, cmdINVCMD, cmdSHOWPHOTO, cmdUPDTRUST, cmdCHKTRUST,
-    cmdADDCARDKEY, cmdKEYTOCARD, cmdBKUPTOCARD, cmdCLEAN, cmdNOP
+    cmdADDCARDKEY, cmdKEYTOCARD, cmdBKUPTOCARD, cmdCLEAN, cmdMINIMIZE, cmdNOP
   };
 
 static struct
@@ -1443,6 +1443,8 @@ static struct
     { "showphoto",cmdSHOWPHOTO , 0, N_("show selected photo IDs") },
     { "clean",    cmdCLEAN     , KEYEDIT_NOT_SK,
       N_("clean unusable parts from key") },
+    { "minimize", cmdMINIMIZE  , KEYEDIT_NOT_SK,
+      N_("clean unusable parts from key and remove all signatures") },
     { NULL, cmdNONE, 0, NULL }
   };
 
@@ -2180,7 +2182,7 @@ keyedit_menu( const char *username, STRLIST locusr,
                     || ascii_strcasecmp(arg_string,"signatures")==0
                     || ascii_strcasecmp(arg_string,"certs")==0
                     || ascii_strcasecmp(arg_string,"certificates")==0)
-                   modified=menu_clean_sigs_from_uids(keyblock);
+                   modified=menu_clean_sigs_from_uids(keyblock,0);
                  else if(ascii_strcasecmp(arg_string,"uids")==0)
                    redisplay=modified=menu_clean_uids_from_key(keyblock);
                  else
@@ -2188,13 +2190,19 @@ keyedit_menu( const char *username, STRLIST locusr,
                }
              else
                {
-                 modified=menu_clean_sigs_from_uids(keyblock);
+                 modified=menu_clean_sigs_from_uids(keyblock,0);
                  modified+=menu_clean_uids_from_key(keyblock);
                  redisplay=modified;
                }
            }
            break;
 
+         case cmdMINIMIZE:
+           modified=menu_clean_sigs_from_uids(keyblock,1);
+           modified+=menu_clean_uids_from_key(keyblock);
+           redisplay=modified;
+           break;
+
          case cmdQUIT:
            if( have_commands )
                goto leave;
@@ -3184,7 +3192,7 @@ menu_delsig( KBNODE pub_keyblock )
 }
 
 static int
-menu_clean_sigs_from_uids(KBNODE keyblock)
+menu_clean_sigs_from_uids(KBNODE keyblock,int self_only)
 {
   KBNODE uidnode;
   int modified=0;
@@ -3199,7 +3207,7 @@ menu_clean_sigs_from_uids(KBNODE keyblock)
          char *user=utf8_to_native(uidnode->pkt->pkt.user_id->name,
                                    uidnode->pkt->pkt.user_id->len,
                                    0);
-         deleted=clean_sigs_from_uid(keyblock,uidnode,opt.verbose,0);
+         deleted=clean_sigs_from_uid(keyblock,uidnode,opt.verbose,self_only);
          if(deleted)
            {
              tty_printf(deleted==1?
index dbcab27..d1a0116 100644 (file)
@@ -1659,8 +1659,6 @@ clean_sigs_from_uid(KBNODE keyblock,KBNODE uidnode,int noisy,int self_only)
    We don't actually remove the user ID packet itself since it might
    be ressurected in a later merge.
 
-   If this self-sig is a revocation, we also include the most recent
-   valid regular sig since it is hard to import the user ID otherwise.
    TODO: change the import code to allow importing a uid with only a
    revocation if the uid already exists on the keyring. */
 int