[patch] key edit menu, delete sigs command

Remi Guyomarch rguyom at mail.dotcom.fr
Mon Jun 7 06:21:31 CEST 1999


delsig have a strange behaviour :

Command> delsig
uid  Mr Magoo <mrmagoo at hfdirect.com>
sig!       xxxxxxxx 1998-03-26   [self-signature]
Delete this good signature? (y/N/q)
uid  Mr Magoo <mrmagoo at hfdirect.com>
sig!       yyyyyyyy 1998-04-06   Mr Magoo <magoo at distributed.net>
Delete this good signature? (y/N/q)
uid  Mr Magoo <mrmagoo at hfdirect.com>
Delete this invalid signature? (y/N/q)
uid  Mr Magoo <mrmagoo at hfdirect.com>
Delete this invalid signature? (y/N/q)
uid  Mr Magoo <mrmagoo at hfdirect.com>
sig!       85BD8B1B 1999-06-07   Remi Guyomarch (DSS) <rguyom at mail.dotcom
Delete this good signature? (y/N/q)y
Really delete this self-signature? (y/N)n
Nothing deleted.                         

1) the lines :
	uid  Mr Magoo <mrmagoo at hfdirect.com>
	Delete this invalid signature? (y/N/q)
are wrong, since a signature made by an unknown key isn't invalid
(since we can't test it), and it should print the key ID at least, or
print nothing but ask nothing about this signature.

2) it think my sig on Mr Magoo's key is a self-signature.

I'm attaching a patch for these problems. Line numbers may be wrong
since I have another patch floating around in keyedit.c...

Btw, there is no Mr Magoo, neither at hfdirect nor at distributed.net :-)

Index: helptext.c
===================================================================
RCS file: /home/koch/cvs/gnupg/g10/helptext.c,v
retrieving revision 1.7
diff -u -r1.7 helptext.c
--- helptext.c  1999/05/27 07:45:42     1.7
+++ helptext.c  1999/06/07 05:03:30
@@ -178,10 +178,15 @@
  "to delete this signature may be important to establish a trust\n"
  "connection to the key or another key certified by this key."
 },
+{ N_("keyedit.delsig.unknown"),
+ "This signature can't be checked because you don't have the\n"
+ "corresponding key.  You should postpone its deletion until you\n"
+ "know which key was used because this signing key might establish"
+ "a trust connection through another already certified key."
+},
 { N_("keyedit.delsig.invalid"),
  "The signature is not valid.  It does make sense to remove it from\n"
- "your keyring if it is really invalid and not just unchecked due to\n"
- "a missing public key (marked by \"sig?\")."
+ "your keyring."
 },
 { N_("keyedit.delsig.selfsig"),
  "This is a signature which binds the user ID to the key. It is\n"
Index: keyedit.c
===================================================================
RCS file: /home/koch/cvs/gnupg/g10/keyedit.c,v
retrieving revision 1.46
diff -u -r1.46 keyedit.c
--- keyedit.c   1999/05/27 07:45:42     1.46
+++ keyedit.c   1999/06/07 05:03:33
@@ -111,7 +111,7 @@
 static int
 print_and_check_one_sig( KBNODE keyblock, KBNODE node,
                         int *inv_sigs, int *no_key, int *oth_err,
-                                       int *is_selfsig )
+                        int *is_selfsig, int print_without_key )
 {
     PKT_signature *sig = node->pkt->pkt.signature;
     int rc, sigrc;
@@ -141,7 +141,7 @@
            ++*oth_err;
        break;
     }
-    if( sigrc != '?' ) {
+    if( sigrc != '?' || print_without_key ) {
        tty_printf("%s%c       %08lX %s   ",
                is_rev? "rev":"sig",
                sigrc, sig->keyid[1], datestr_from_sig(sig));
@@ -205,7 +205,7 @@
            int selfsig;
 
            if( print_and_check_one_sig( keyblock, node, &inv_sigs,
-                                        &no_key, &oth_err, &selfsig ) ) {
+                                        &no_key, &oth_err, &selfsig, 0 ) ) {
                if( selfsig )
                    has_selfsig = 1;
            }
@@ -1275,24 +1292,33 @@
            uid = (node->flag & NODFLG_SELUID)? node->pkt->pkt.user_id : NULL;
        }
        else if( uid && node->pkt->pkttype == PKT_SIGNATURE ) {
-           int okay, valid, selfsig;
+           int okay, valid, selfsig, inv_sig, no_key, other_err;
 
            tty_printf("uid  ");
            tty_print_string( uid->name, uid->len );
            tty_printf("\n");
 
+           okay = inv_sig = no_key = other_err = 0;
            valid = print_and_check_one_sig( pub_keyblock, node,
-                                            NULL, NULL, NULL, &selfsig );
+                                            &inv_sig, &no_key, &other_err,
+                                            &selfsig, 1 );
 
-           okay = valid ? cpr_get_answer_yes_no_quit(
-                              "keyedit.delsig.valid",
-                             _("Delete this good signature? (y/N/q)"))
-                        : cpr_get_answer_yes_no_quit(
-                              "keyedit.delsig.invalid",
-                             _("Delete this invalid signature? (y/N/q)"));
+           if( valid )
+               okay = cpr_get_answer_yes_no_quit(
+                   "keyedit.delsig.valid",
+                   _("Delete this good signature? (y/N/q)"));
+           else if( inv_sig || other_err )
+               okay = cpr_get_answer_yes_no_quit(
+                   "keyedit.delsig.invalid",
+                   _("Delete this invalid signature? (y/N/q)"));
+           else if( no_key )
+               okay = cpr_get_answer_yes_no_quit(
+                   "keyedit.delsig.unknown",
+                   _("Delete this unknown signature? (y/N/q)"));
+           
            if( okay == -1 )
                break;
-           if( okay && !cpr_get_answer_is_yes(
+           if( okay && selfsig && !cpr_get_answer_is_yes(
                               "keyedit.delsig.selfsig",
                              _("Really delete this self-signature? (y/N)") ))
                okay = 0;

-- 
Rémi        <rguyom at mail.dotcom.fr> | Don't waste your computer's time :
    PGP-encrypt anything important: | http://www.distributed.net/
   www.gnupg.org - KeyID:0x85BD8B1B | http://www.distributed.net/source/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 241 bytes
Desc: not available
Url : /pipermail/attachments/19990607/7df1bb8a/attachment.bin


More information about the Gnupg-devel mailing list