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

* keyedit.c (keyedit_menu, menu_clean_sigs_from_uids): Add "minimize"

command.
This commit is contained in:
David Shaw 2005-11-10 23:25:20 +00:00
parent 843d5719e7
commit a81633ca7d
3 changed files with 19 additions and 10 deletions

View File

@ -1,5 +1,8 @@
2005-11-10 David Shaw <dshaw@jabberwocky.com> 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 * packet.h, keyedit.c (menu_clean_uids_from_key), trustdb.c
(clean_uids_from_key): Fix display bug where sigs cleaned for (clean_uids_from_key): Fix display bug where sigs cleaned for
other reasons caused a uid to appear as if it had been compacted. 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 * trustdb.h, trustdb.c (clean_sigs_from_uid): Add flag to remove
all non-selfsigs from key during cleaning. Change all callers. all non-selfsigs from key during cleaning. Change all callers.
* export.c (do_export_stream): Use it here so we don't need * export.c (do_export_stream): Use it here for export-minimal so
additional minimize code in the export path. we don't need additional minimize code in the export path.
2005-11-06 David Shaw <dshaw@jabberwocky.com> 2005-11-06 David Shaw <dshaw@jabberwocky.com>

View File

@ -57,7 +57,7 @@ static int menu_adduid( KBNODE keyblock, KBNODE sec_keyblock,
int photo, const char *photo_name ); int photo, const char *photo_name );
static void menu_deluid( KBNODE pub_keyblock, KBNODE sec_keyblock ); static void menu_deluid( KBNODE pub_keyblock, KBNODE sec_keyblock );
static int menu_delsig( KBNODE pub_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 int menu_clean_uids_from_key(KBNODE keyblock);
static void menu_delkey( KBNODE pub_keyblock, KBNODE sec_keyblock ); static void menu_delkey( KBNODE pub_keyblock, KBNODE sec_keyblock );
static int menu_addrevoker( KBNODE pub_keyblock, static int menu_addrevoker( KBNODE pub_keyblock,
@ -1341,7 +1341,7 @@ enum cmdids
cmdADDREVOKER, cmdTOGGLE, cmdSELKEY, cmdPASSWD, cmdTRUST, cmdPREF, cmdADDREVOKER, cmdTOGGLE, cmdSELKEY, cmdPASSWD, cmdTRUST, cmdPREF,
cmdEXPIRE, cmdBACKSIGN, cmdENABLEKEY, cmdDISABLEKEY, cmdSHOWPREF, cmdEXPIRE, cmdBACKSIGN, cmdENABLEKEY, cmdDISABLEKEY, cmdSHOWPREF,
cmdSETPREF, cmdPREFKS, cmdINVCMD, cmdSHOWPHOTO, cmdUPDTRUST, cmdCHKTRUST, cmdSETPREF, cmdPREFKS, cmdINVCMD, cmdSHOWPHOTO, cmdUPDTRUST, cmdCHKTRUST,
cmdADDCARDKEY, cmdKEYTOCARD, cmdBKUPTOCARD, cmdCLEAN, cmdNOP cmdADDCARDKEY, cmdKEYTOCARD, cmdBKUPTOCARD, cmdCLEAN, cmdMINIMIZE, cmdNOP
}; };
static struct static struct
@ -1443,6 +1443,8 @@ static struct
{ "showphoto",cmdSHOWPHOTO , 0, N_("show selected photo IDs") }, { "showphoto",cmdSHOWPHOTO , 0, N_("show selected photo IDs") },
{ "clean", cmdCLEAN , KEYEDIT_NOT_SK, { "clean", cmdCLEAN , KEYEDIT_NOT_SK,
N_("clean unusable parts from key") }, 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 } { 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,"signatures")==0
|| ascii_strcasecmp(arg_string,"certs")==0 || ascii_strcasecmp(arg_string,"certs")==0
|| ascii_strcasecmp(arg_string,"certificates")==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) else if(ascii_strcasecmp(arg_string,"uids")==0)
redisplay=modified=menu_clean_uids_from_key(keyblock); redisplay=modified=menu_clean_uids_from_key(keyblock);
else else
@ -2188,13 +2190,19 @@ keyedit_menu( const char *username, STRLIST locusr,
} }
else else
{ {
modified=menu_clean_sigs_from_uids(keyblock); modified=menu_clean_sigs_from_uids(keyblock,0);
modified+=menu_clean_uids_from_key(keyblock); modified+=menu_clean_uids_from_key(keyblock);
redisplay=modified; redisplay=modified;
} }
} }
break; break;
case cmdMINIMIZE:
modified=menu_clean_sigs_from_uids(keyblock,1);
modified+=menu_clean_uids_from_key(keyblock);
redisplay=modified;
break;
case cmdQUIT: case cmdQUIT:
if( have_commands ) if( have_commands )
goto leave; goto leave;
@ -3184,7 +3192,7 @@ menu_delsig( KBNODE pub_keyblock )
} }
static int static int
menu_clean_sigs_from_uids(KBNODE keyblock) menu_clean_sigs_from_uids(KBNODE keyblock,int self_only)
{ {
KBNODE uidnode; KBNODE uidnode;
int modified=0; 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, char *user=utf8_to_native(uidnode->pkt->pkt.user_id->name,
uidnode->pkt->pkt.user_id->len, uidnode->pkt->pkt.user_id->len,
0); 0);
deleted=clean_sigs_from_uid(keyblock,uidnode,opt.verbose,0); deleted=clean_sigs_from_uid(keyblock,uidnode,opt.verbose,self_only);
if(deleted) if(deleted)
{ {
tty_printf(deleted==1? tty_printf(deleted==1?

View 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 We don't actually remove the user ID packet itself since it might
be ressurected in a later merge. 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 TODO: change the import code to allow importing a uid with only a
revocation if the uid already exists on the keyring. */ revocation if the uid already exists on the keyring. */
int int