home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / varia / pgp / pgpamiga / source / todo < prev    next >
Internet Message Format  |  1993-12-23  |  28KB

  1. From dino.dinoco.de!teralon.GUN.de!wnet.edex.edu.au!simons Thu, 9 Dec 93 23:26:04 +0100
  2. Received: by peti.GUN.de (V1.16/Amiga)
  3.         id AA00000; Thu, 9 Dec 93 23:26:04 +0100
  4. Received: by dino.dinoco.de (V1.16/Amiga)
  5.           id <8u8l@dino.dinoco.de>; Thu, 9 Dec 93 14:54:43 +0100
  6. Received: by teralon.GUN.de (Smail3.1.28.1)
  7.           from rs1.rrz.Uni-Koeln.DE with smtp
  8.           id <m0p7io2-0004PEA>; Thu, 9 Dec 93 09:41 CET
  9. Received: from alsvid.une.edu.au by rs1.rrz.Uni-Koeln.DE with SMTP id AA41689
  10.   (5.65c/IDA-1.4.4 for <simons@peti.gun.de>); Thu, 9 Dec 1993 09:36:35 +0100
  11. Received: by alsvid.une.edu.au id AA23375
  12.   (5.65c8+/IDA-1.4.4 for peti.gun.de!simons); Thu, 9 Dec 1993 19:34:00 +1100
  13. Received: by wnet.edex.edu.au (\/<>\/ SmailAmiga 1.02j21)
  14.           id <m0p7nZ6-0000XAT>; Thu, 9 Dec 1993 15:46:04 +1100
  15. In-Reply-To: <9312050323.AA00fe3@aargh.adsp.sub.org>
  16. X-Mailer: //\\miga Electronic Mail (AmiElm 2.253)
  17. Errors-To: pgpmip-owner@wnet.edex.edu.au
  18. Message-Id: <9312090338.0k4u@peti.GUN.de>
  19. Date: Thu, 9 Dec 1993 15:46:04 +1100
  20. Reply-To: pgpmip@wnet.edex.edu.au
  21. From: simons@peti.GUN.de (Peter Simons)
  22. To: simons@peti.gun.de
  23. Subject: (133) PGPMIP still alive?
  24.  
  25.        List: PGPMIP - PGP Mail Intergration Project - Mail List
  26.        From: Peter Simons <simons@peti.GUN.de>
  27.        Date: Wed, 8 Dec 93 21:38:03 +0100
  28.        Subj: Re: (131) PGPMIP still alive?
  29.  
  30. Hi Marc, in <9312050323.AA00fe3@aargh.adsp.sub.org> on Dec 5 you
  31. wrote:
  32.  
  33.  > Three things:
  34.  >
  35.  > a) Is this mailinglist still alive?
  36.  
  37. Yes, it is. I'm stuck with my job, LharcUUCP and the pgp.library, but
  38. I'll finish the PGPMIP stuff before Xmas, definetly.
  39.  
  40.  
  41.  > b) Is PGPMIP still under development?  Is the Amiga version (that I have in
  42.  > beta) now finished or already released?
  43.  
  44. It isn't really announced anywhere, but since the archive is available
  45. via BMS from peti, it'd call it pretty official. Although it still
  46. needs some work.
  47.  
  48.  
  49.  > c)  Is  it  possible to add a new variable to the Amiga version?  I need an
  50.  > option for 'your user id'.  PGP uses the first entry in the secret key ring
  51.  > if  it  is not supplied.  Sometimes this can be very annoying if you forget
  52.  > to  extract  -  remove  -  re-add  your  preffered  secret key.  I think of
  53.  > something  like  uulib:config entry 'PGPPrefferedUID' and a env variable of
  54.  > the  same  name (overriding the config entry).  This should be optional, ie
  55.  > not specifying it should force same behaviour as it is now.
  56.  
  57. Good idea! I'll add this into PGP, too.
  58.  
  59.         bye, Peter
  60.  
  61.  
  62.  
  63. --
  64.  **** **** ***** ***
  65.  *  * *      *    *     ACCEPTING: PGP, MIME and BMS
  66.  **** ***    *    *
  67.  *    *      *    *         PHONE: +49 228 746061
  68.  *    ****   *   ***
  69.  
  70. From dino.dinoco.de!teralon.GUN.de!extropia.wimsey.com!pgp-dev-request Mon, 13 Dec 93 19:59:21 +0100
  71. Received: by peti.GUN.de (V1.16/Amiga)
  72.         id AA00000; Mon, 13 Dec 93 19:59:21 +0100
  73. Received: by dino.dinoco.de (V1.16/Amiga)
  74.           id <8w4z@dino.dinoco.de>; Mon, 13 Dec 93 18:50:27 +0100
  75. Received: by teralon.GUN.de (Smail3.1.28.1)
  76.           from rs1.rrz.Uni-Koeln.DE with smtp
  77.           id <m0p8pEP-0004P3A>; Sun, 12 Dec 93 10:44 CET
  78. Received: from vanbc.wimsey.com by rs1.rrz.Uni-Koeln.DE with SMTP id AA76953
  79.   (5.65c/IDA-1.4.4 for <SIMONS@PETI.GUN.DE>); Sun, 12 Dec 1993 10:40:37 +0100
  80. Received: by vanbc.wimsey.com (Smail3.1.28.1)
  81.         id m0p8n2r-0000SaC; Sun, 12 Dec 93 01:24 PST
  82. Received: by xtropia id AA06551
  83.   (5.65c/IDA-1.4.4 for pgp-dev-dist@extropia.wimsey.com); Sun, 12 Dec 1993 01:05:59 -0800
  84. Resent-Message-Id: <m0p8n2r-0000SaC@vanbc.wimsey.com>
  85. Resent-Sender: pgp-dev-request@extropia.wimsey.com
  86. Message-Id: <9312120859.AA15337@binkley.MIT.EDU>
  87. Date: Sun, 12 Dec 93 03:59:36 EST
  88. Resent-From: pgp-dev@extropia.wimsey.com
  89. X-Mailing-List: <pgp-dev@extropia.wimsey.com> archive/latest/169
  90. Comment: Contact miron@extropia.wimsey.com for information about this service.
  91. X-Loop: pgp-dev@extropia.wimsey.com
  92. Precedence: list
  93. Resent-Sender: pgp-dev-request@extropia.wimsey.com
  94. From: Derek Atkins <warlord@MIT.EDU>
  95. To: pgp-dev@extropia.wimsey.com
  96. Subject: PGP bugs (fwd)
  97. X-Status: OR
  98.  
  99. I was sent this message.  I thought I'd forward it, even though
  100. no one seems to be working on fixing bugs.  It would be a good
  101. idea to make sure these don't get repeated.  I haven't looked at
  102. the code myself to create a fix.
  103.  
  104. -derek
  105. ------- Forwarded Message
  106.  
  107. Date: Sun, 12 Dec 93 02:40:52 EST
  108. From: Calvin Clark <ckclark@MIT.EDU>
  109. To: warlord@MIT.EDU
  110. Subject: PGP bugs
  111. Content-Length: 7883
  112.  
  113.  
  114. - -----BEGIN PGP SIGNED MESSAGE-----
  115.  
  116. [ Derek:
  117.  
  118. Please read this report and forward it the appropriate people.
  119.  
  120.         -Calvin ]
  121.  
  122.  
  123. This message is a report of three bugs in PGP 2.3A:
  124.  
  125. fileio.c: buildfilename()
  126.         - silent truncation of PGPPATH
  127.         - possible overflow problem in some situations
  128. random.c: getstring()
  129.         - infinite loop
  130.  
  131. No fixes are included, as there seem to be arbritary choices
  132. in the present code that I do not understand, and I'd
  133. rather not take chances mucking with it.
  134.  
  135. - - ----------------------------------------------------------------------
  136.  
  137. I'm not sure if this was the case in earlier versions of PGP, but 2.3A
  138. silently ignores your PGPPATH enviornment variable if it is longer than
  139. 50 characters.  Look at fileio.c:
  140.  
  141.  
  142. char *buildfilename(char *result, char *fname)
  143. /*      Builds a filename with a complete path specifier from the environmental
  144.         variable PGPPATH.
  145. */
  146. {       char *s = getenv(PGPPATH);
  147.  
  148.         if ( s==NULL || strlen(s) > 50) /* undefined, or too long to use */
  149.                 s="";
  150.         strcpy(result,s);
  151.  
  152. The string passed to this routine as "result" is usually a static
  153. character array of dimension MAX_PATH, which is set (in pgp.h) to 64 on
  154. MSDOS systems and 256 on other systems.
  155.  
  156. Now I can understand why, with a program like pgp, one might not want to
  157. trust the system header file or POSIX pathconf() definitions for the
  158. maximum path length.  It is acceptable to choose an internal limit that
  159. is almost certainly lower than the system limit.  However, it is a bug
  160. that it treats a long PGPPATH envionment variable the same as if it is
  161. not set at all.  It should, at the very least, print a message like:
  162.  
  163. warning: PGPPATH too long; maximum is <whatever>
  164.  
  165. Also, the in-lined 50 is bad coding style.  The limit is really imposed
  166. by the value of MAX_PATH, so something like MAX_PATH - strlen (fname) -
  167. 2 or something should be used instead.
  168.  
  169. This brings up another bug: the length of fname is not checked in the
  170. routine buildfilename(), so if the combined length of the PGPPATH and
  171. the filename is longer than MAX_PATH, the strcat() may overflow,
  172. producing unpredictable side-effects.  Looking at the rest of the code,
  173. it seems that it is possible for this to happen on MSDOS systems, since
  174. it is possible to enter a filename of up to 59 characters in length (see
  175. line 766 in keymgmt.c, where getstring() is called with an explicit
  176. length argument of 59.  I have no idea where the `59' comes from.)
  177.  
  178. This brings me to yet another bug, which I haven't had time to examine
  179. yet.  It may be a problem with getstring(), or with something else.
  180. However, it does not deal correctly when I try to type a long filename.
  181.  
  182. [ Everything that follows refers to pgp23A on Solaris 2.1. ]
  183.  
  184. Example:
  185.  
  186.   ; PGPPATH=/oeuentg
  187.   # 204 <ckclark@w20-575-19>:/tmp
  188.   ; !pgp
  189.   pgp -sta +clearsig=on motd
  190.   Cannot open configuration file /oeuentg/config.txt
  191.   Pretty Good Privacy 2.3a - Public-key encryption for the masses.
  192.   (c) 1990-1993 Philip Zimmermann, Phil's Pretty Good Software. 1 Jul 93
  193.   Date: 1993/12/12 06:20 GMT
  194.  
  195.   A secret key is required to make a signature.
  196.   You specified no user ID to select your secret key,
  197.   so the default user ID and key will be the most recently
  198.   added key on your secret keyring.
  199.  
  200.   Keyring file '/oeuentg/secring.pgp' does not exist. Enter public key filename: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*
  201.  
  202. As I said, I have not looked at the problem in detail.  Here is a gdb
  203. stack trace of where it is when the hanging occurs.  I think (though it
  204. is not demonstrated here) that there is an infinite loop in lines
  205. 764,765 of random.c, which read:
  206.  
  207. 764                             while (keypress())
  208. 765                                     getkey();       /* clean up any typeahead */
  209.  
  210. It think keypress() is always returning a true value in this loop.  The
  211. whole section is rather fishy anyway, since stepping through it reveals
  212. that pgp is generating random numbers and setting timers and stuff when
  213. it reads the filename, which strikes me as being somewhat gratuitious.
  214. I've always found fgets() adequate for reading strings from the standard
  215. input if they're going to be echoed; maybe I'm just weird, but I think
  216. that calling getstring() to read a filename as if it were a password is
  217. overkill.
  218.  
  219.   ; gdb ./pgp
  220.   GDB is free software and you are welcome to distribute copies of it
  221.    under certain conditions; type "show copying" to see the conditions.
  222.   There is absolutely no warranty for GDB; type "show warranty" for details.
  223.   GDB 4.11 (sparc-sun-solaris2.1),
  224.   Copyright 1993 Free Software Foundation, Inc...
  225.   (gdb) run -sta +clearsig=on motd
  226.   Starting program: /tmp/pgp23A/src/./pgp -sta +clearsig=on motd
  227.   Cannot open configuration file /oeuentg/config.txt
  228.   Pretty Good Privacy 2.3a - Public-key encryption for the masses.
  229.   (c) 1990-1993 Philip Zimmermann, Phil's Pretty Good Software. 1 Jul 93
  230.   Date: 1993/12/12 07:09 GMT
  231.  
  232.   A secret key is required to make a signature.
  233.   You specified no user ID to select your secret key,
  234.   so the default user ID and key will be the most recently
  235.   added key on your secret keyring.
  236.  
  237.   Keyring file '/oeuentg/secring.pgp' does not exist. Enter public key filename: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*
  238.  
  239.   Program received signal SIGINT (2), Interrupt
  240.  
  241.   0xef7a6d60 in read ()
  242.   (gdb) where
  243.   #0  0xef7a6d60 in read ()
  244.   #1  0x39b5c in getch () at system.c:272
  245.   #2  0x3669c in keypress () at random.c:576
  246.   #3  0x36f80 in getstring (strbuf=0xefffe970 'x' <repeats 59 times>, maxlen=59,
  247.       echo=1 '\001') at random.c:764
  248.   #4  0x22cc0 in getpublickey (flags=0,
  249.       keyfile=0xefffe970 'x' <repeats 59 times>, _file_position=0xefffe96c,
  250.       _pktlen=0x0, keyID=0x0, timestamp=0xeffff170 "", userid=0xeffff068 "",
  251.       n=0xefffee58, e=0xefffedb0) at keymgmt.c:766
  252.   #5  0x23170 in getsecretkey (flags=0,
  253.       keyfile=0xefffe970 'x' <repeats 59 times>, keyID=0x0,
  254.       timestamp=0xeffff170 "", hpass=0x0, hkey=0x0, userid=0xeffff068 "",
  255.       n=0xefffee58, e=0xefffedb0, d=0xefffed08, p=0xefffec60, q=0xefffebb8,
  256.       u=0xefffeb10) at keymgmt.c:903
  257.   #6  0x1b1c8 in signfile (nested=0 '\000', separate_signature=1 '\001',
  258.       mcguffin=0x60fc8 "", infile=0x670d8 "motd.$16",
  259.       outfile=0x671e0 "motd.$17", lit_mode=116 't',
  260.       literalfile=0xeffff5e0 "motd") at crypto.c:908
  261.   #7  0x15a58 in main (argc=4, argv=0xeffff784) at pgp.c:817
  262.   (gdb) up 1
  263.   #1  0x39b5c in getch () at system.c:272
  264.   272             read(ttyfd, &c, 1);
  265.   (gdb) list
  266.   267     #ifdef USE_NBIO
  267.   268             while (!kbhit());       /* kbhit() does the reading */
  268.   269             c = kbuf;
  269.   270             kbuf = -1;
  270.   271     #else
  271.   272             read(ttyfd, &c, 1);
  272.   273     #endif
  273.   274             return(c);
  274.   275     }
  275.   276
  276.   (gdb) up 2
  277.   #3  0x36f80 in getstring (strbuf=0xefffe970 'x' <repeats 59 times>, maxlen=59,
  278.       echo=1 '\001') at random.c:764
  279.   764                             while (keypress())
  280.   (gdb) list
  281.   759                     if (c=='\n')
  282.   760                             break;
  283.   761                     strbuf[i++] = c;
  284.   762                     if (i>=maxlen)
  285.   763                     {       fprintf(stderr,"\007*\n");      /* -Enough! */
  286.   764                             while (keypress())
  287.   765                                     getkey();       /* clean up any typeahead */
  288.   766                             break;
  289.   767                     }
  290.   768             }
  291.   (gdb)
  292.  
  293. Calvin Clark <ckclark@MIT.EDU>
  294. (Key 6E9CF1, available from servers or upon request.)
  295.  
  296. - -----BEGIN PGP SIGNATURE-----
  297. Version: 2.3a
  298.  
  299. iQCVAgUBLQrKPH1TfRQIbpzxAQE+eAP/Q2uLWhDS3mvKp8fReCeZzpvDtHKAJdEk
  300. 4BEEeVNhWaN9C1U2hEa25JSbtiMrcRj1ZVlREeYM/kz6Tez/s98rWHTfhQM4kwAy
  301. /FV7xnNSrQsBE+vH4s45Y1yUfuKTjDG1jQm+l5d8RXH0EKpaD96kMESvPTOgE8Ve
  302. rvLnMoJhg1o=
  303. =1AoT
  304. - -----END PGP SIGNATURE-----
  305.  
  306. ------- End of Forwarded Message
  307.  
  308.  
  309. *** .bk/keyadd.c        Wed Jun 23 16:53:10 1993
  310. --- ./keyadd.c  Fri May 20 01:03:22 1994
  311. ***************
  312. *** 29,34 ****
  313. --- 29,35 ----
  314.   #include "fileio.h"
  315.   #include "keymgmt.h"
  316.   #include "charset.h"
  317. + #include "mpiio.h"
  318.   #include "language.h"
  319.   #include "pgp.h"
  320.   #include "exitpgp.h"
  321. ***************
  322. *** 48,55 ****
  323.   static int newkeys, newsigs, newids, newrvks;
  324.   static byte mykeyID[KEYFRAGSIZE];
  325.  
  326.   static int mergesigs (FILE *fkey, char *keyfile, long keypos, FILE *fring,
  327. !               char *ringfile, long *pringpos, FILE *out)
  328.   /* Merge signatures from userid in fkey (which is keyfile) at keypos with
  329.    * userid from fring (which is ringfile) at ringpos, appending result to out.
  330.    */
  331. --- 49,95 ----
  332.   static int newkeys, newsigs, newids, newrvks;
  333.   static byte mykeyID[KEYFRAGSIZE];
  334.  
  335. +
  336. + static struct sig_list {
  337. +       struct sig_list *next;
  338. +       long pos;
  339. + } *siglist;
  340. +
  341. + static void
  342. + sig_list_add(long pos)
  343. + {
  344. +       struct sig_list *p;
  345. +       p = xmalloc(sizeof *p);
  346. +       p->pos = pos;
  347. +       p->next = siglist;
  348. +       siglist = p;
  349. + }
  350. +
  351. + static int
  352. + sig_list_find(long pos)
  353. + {
  354. +       struct sig_list *p;
  355. +       for (p = siglist; p; p = p->next)
  356. +               if (p->pos == pos)
  357. +                       return 1;
  358. +       return 0;
  359. + }
  360. +
  361. + static void
  362. + sig_list_clear(void)
  363. + {
  364. +       struct sig_list *p, *n;
  365. +       for (p = siglist; p; p = n) {
  366. +               n = p->next;
  367. +               free(p);
  368. +       }
  369. +       siglist = NULL;
  370. + }
  371. +
  372. +
  373.   static int mergesigs (FILE *fkey, char *keyfile, long keypos, FILE *fring,
  374. !               char *ringfile, long *pringpos, long ringkeypos,
  375. !               long ringkeypktlen, FILE *out)
  376.   /* Merge signatures from userid in fkey (which is keyfile) at keypos with
  377.    * userid from fring (which is ringfile) at ringpos, appending result to out.
  378.    */
  379. ***************
  380. *** 59,66 ****
  381. --- 99,108 ----
  382.         int status;
  383.         byte ctb;
  384.         int copying;
  385. +       word32 rstamp, kstamp;
  386.         byte keyID[KEYFRAGSIZE];
  387.         char userid[256];
  388. +       char sigid[256];
  389.  
  390.         /* First, copy the userid packet itself, plus any comments or ctrls */
  391.         ringuseridpos = ringpos = *pringpos;
  392. ***************
  393. *** 100,111 ****
  394.         copying = FALSE;
  395.         for ( ; ; )
  396.         {       /* Read next sig from keyfile; see if it is in ringfile;
  397. !                * set copying true/false accordingly.  If copying is true
  398. !                * and it is a signature, copy it.  Loop till hit
  399. !                * a new key or userid in keyfile, or EOF.
  400.                  */
  401.                 keypos = ftell(fkey);
  402. !               status = readkeypacket(fkey,FALSE,&ctb,NULL,NULL,NULL,NULL,
  403.                                 NULL,NULL,NULL,NULL,keyID,NULL);
  404.                 if (status == -3)       /* unrecoverable error: bad packet length etc. */
  405.                         return(status);
  406. --- 142,155 ----
  407.         copying = FALSE;
  408.         for ( ; ; )
  409.         {       /* Read next sig from keyfile; see if it is in ringfile;
  410. !                * if it is not a signature, ignore it,
  411. !                * if it is absent from ringfile, copy it,
  412. !                * if it is present, and the timestamp is not newer, ignore it,
  413. !                * if present and newer, replace old with new.
  414. !                * Loop till hit a new key or userid in keyfile, or EOF.
  415.                  */
  416.                 keypos = ftell(fkey);
  417. !               status = readkeypacket(fkey,FALSE,&ctb,(byte *)&kstamp,NULL,NULL,NULL,
  418.                                 NULL,NULL,NULL,NULL,keyID,NULL);
  419.                 if (status == -3)       /* unrecoverable error: bad packet length etc. */
  420.                         return(status);
  421. ***************
  422. *** 118,126 ****
  423.                 {       long sig_pos;
  424.                         int sig_len;
  425.                         /* Set copying true if signature is not in the ringfile */
  426. !                       copying = (getpubusersig (ringfile, ringuseridpos, keyID, &sig_pos,
  427. !                                               &sig_len) < 0);
  428. !                       if (copying)
  429.                         {       char *signator;
  430.                                 if ((signator = user_from_keyID(keyID)) == NULL)
  431.                                         fprintf(pgpout, PSTR("New signature from keyID %s on userid \"%s\"\n"),
  432. --- 162,225 ----
  433.                 {       long sig_pos;
  434.                         int sig_len;
  435.                         /* Set copying true if signature is not in the ringfile */
  436. !                       copying = (getpubusersig (ringfile, ringuseridpos, keyID,
  437. !                                       (byte *)&rstamp, &sig_pos, &sig_len) < 0);
  438. !                       if (!copying) {
  439. !                               long save_pos = ftell(fkey);
  440. !                               fseek(fkey, keypos+6, SEEK_SET);
  441. !                               fread(&kstamp,1,SIZEOF_TIMESTAMP,fkey);
  442. !                               convert_byteorder((byte *)&kstamp,SIZEOF_TIMESTAMP);
  443. !                               if (verbose)
  444. !                                       fprintf(pgpout, "ring: %lx  key: %lx\n", rstamp, kstamp);
  445. !                               if (kstamp > rstamp) { /* Update */
  446. !                                       byte sig_class = 0xff;
  447. !                                       if (verbose)
  448. !                                               fprintf(pgpout, "checking new signature\n");
  449. !                                       CToPascal(userid);
  450. !                                       status = check_key_sig(fring, ringkeypos, ringkeypktlen,
  451. !                                                       userid, fkey, keypos, ringfile, sigid,
  452. !                                                       (byte *)&kstamp, &sig_class);
  453. !                                       PascalToC(userid);
  454. !                                       PascalToC(sigid);
  455. !                                       switch (status) {
  456. !                                       case 0:         /* signature OK */
  457. !                                               switch (sig_class) {
  458. !                                               case K0_SIGNATURE_BYTE:
  459. !                                               case K1_SIGNATURE_BYTE:
  460. !                                               case K2_SIGNATURE_BYTE:
  461. !                                               case K3_SIGNATURE_BYTE:
  462. !                                                       copying = 1;
  463. !                                                       fprintf(pgpout, PSTR("Replacing signature from %s\n"),
  464. !                                                                       LOCAL_CHARSET(sigid));
  465. !                                                       break;
  466. ! #ifdef notyet
  467. !                                               case KR_SIGNATURE_BYTE:
  468. !                                                       copying = 1;
  469. !                                                       fprintf(pgpout, PSTR("Signature revocation from %s\n"),
  470. !                                                                       LOCAL_CHARSET(sigid));
  471. !                                                       break;
  472. ! #endif
  473. !                                               default:
  474. !                                                       fprintf(pgpout, PSTR("Unknown signature class %#x from %s\n"),
  475. !                                                                       sig_class, LOCAL_CHARSET(sigid));
  476. !                                               }
  477. !                                               if (copying)
  478. !                                                       sig_list_add(sig_pos);
  479. !                                               break;
  480. !                                       case -2:
  481. !                                               fprintf(pgpout, PSTR("\007*** BAD NEW SIGNATURE, class %#x from %s\n"),
  482. !                                                               sig_class, LOCAL_CHARSET(sigid));
  483. !                                               break;
  484. !                                       default:
  485. !                                               /* don't replace if we can't check the new signature */
  486. !                                               fprintf(pgpout, PSTR("Can't check new signature from keyID %s\n"),
  487. !                                                               keyIDstring(keyID));
  488. !                                       }
  489. !                                       fprintf(pgpout, PSTR("on userid \"%s\"\n"), LOCAL_CHARSET(userid));
  490. !                               }
  491. !                               fseek(fkey, save_pos, SEEK_SET);
  492. !                       }
  493. !                       else
  494.                         {       char *signator;
  495.                                 if ((signator = user_from_keyID(keyID)) == NULL)
  496.                                         fprintf(pgpout, PSTR("New signature from keyID %s on userid \"%s\"\n"),
  497. ***************
  498. *** 130,136 ****
  499.                                         fprintf(pgpout, PSTR("New signature from %s\n"), LOCAL_CHARSET(signator));
  500.                                         fprintf(pgpout, PSTR("on userid \"%s\"\n"), LOCAL_CHARSET(userid));
  501.                                 }
  502. !                               ++newsigs;
  503.                                 if (batchmode)
  504.                                         show_update(keyIDstring(mykeyID));
  505.                         }
  506. --- 229,237 ----
  507.                                         fprintf(pgpout, PSTR("New signature from %s\n"), LOCAL_CHARSET(signator));
  508.                                         fprintf(pgpout, PSTR("on userid \"%s\"\n"), LOCAL_CHARSET(userid));
  509.                                 }
  510. !                       }
  511. !                       if (copying)
  512. !                       {       ++newsigs;
  513.                                 if (batchmode)
  514.                                         show_update(keyIDstring(mykeyID));
  515.                         }
  516. ***************
  517. *** 142,151 ****
  518.                 }
  519.         }
  520.  
  521. !       /* Third, for all ring sig's, copy to output */
  522.         fseek (fring, ringpos, SEEK_SET);
  523.         for ( ; ; )
  524.         {       ringpos = ftell(fring);
  525.                 status = nextkeypacket (fring, &ctb);
  526.                 ringpktlen = ftell(fring) - ringpos;
  527.                 if (status < 0  ||  is_key_ctb (ctb)  ||  ctb==CTB_USERID)
  528. --- 243,261 ----
  529.                 }
  530.         }
  531.  
  532. !       /* Third, for all ring sig's which are not replaced, copy to output */
  533.         fseek (fring, ringpos, SEEK_SET);
  534.         for ( ; ; )
  535.         {       ringpos = ftell(fring);
  536. +               if (sig_list_find(ringpos)) {
  537. +                       /* skip signature packet */
  538. +                       nextkeypacket (fring, &ctb);
  539. +                       ringpos = ftell(fring);
  540. +                       /* skip trust packet, if present */
  541. +                       if (nextkeypacket (fring, &ctb) < 0 || ctb != CTB_KEYCTRL)
  542. +                               fseek(fring, ringpos, SEEK_SET);
  543. +                       continue;
  544. +               }
  545.                 status = nextkeypacket (fring, &ctb);
  546.                 ringpktlen = ftell(fring) - ringpos;
  547.                 if (status < 0  ||  is_key_ctb (ctb)  ||  ctb==CTB_USERID)
  548. ***************
  549. *** 152,157 ****
  550. --- 262,268 ----
  551.                         break;
  552.                 copyfilepos (fring, out, ringpktlen, ringpos);
  553.         }       /* End of loop for each sig in ringfile */
  554. +       sig_list_clear();
  555.         fseek (fring, ringpos, SEEK_SET);
  556.         *pringpos = ringpos;
  557.         return(0);
  558. ***************
  559. *** 165,171 ****
  560.    */
  561.   {
  562.         long ringkeypos, keykeypos, ringpos;
  563. !       int ringpktlen, keypktlen;
  564.         int status;
  565.         byte ctb;
  566.         int copying;
  567. --- 276,282 ----
  568.    */
  569.   {
  570.         long ringkeypos, keykeypos, ringpos;
  571. !       int ringpktlen, keypktlen, ringkeypktlen;
  572.         int status;
  573.         byte ctb;
  574.         int copying;
  575. ***************
  576. *** 176,182 ****
  577.         ringkeypos = ringpos = *pringpos;
  578.         fseek (fring, ringpos, SEEK_SET);
  579.         (void) nextkeypacket(fring, &ctb);
  580. !       ringpktlen = ftell(fring) - ringpos;
  581.         copyfilepos (fring, out, ringpktlen, ringpos);
  582.         for ( ; ; )
  583.         {       ringpos = ftell(fring);
  584. --- 287,293 ----
  585.         ringkeypos = ringpos = *pringpos;
  586.         fseek (fring, ringpos, SEEK_SET);
  587.         (void) nextkeypacket(fring, &ctb);
  588. !       ringkeypktlen = ringpktlen = ftell(fring) - ringpos;
  589.         copyfilepos (fring, out, ringpktlen, ringpos);
  590.         for ( ; ; )
  591.         {       ringpos = ftell(fring);
  592. ***************
  593. *** 312,318 ****
  594.                         /* don't use substring match (exact_match = TRUE) */
  595.                         if (getpubuserid (keyfile, keykeypos, userid, &userid_pos,
  596.                                                 &userid_len, TRUE) >= 0)
  597. !                       {       if ((status = mergesigs (fkey,keyfile,userid_pos,fring,ringfile,&ringpos,out)) < 0)
  598.                                         return(status);
  599.                                 copying = FALSE;
  600.                         }
  601. --- 423,429 ----
  602.                         /* don't use substring match (exact_match = TRUE) */
  603.                         if (getpubuserid (keyfile, keykeypos, userid, &userid_pos,
  604.                                                 &userid_len, TRUE) >= 0)
  605. !                       {       if ((status = mergesigs (fkey,keyfile,userid_pos,fring,ringfile,&ringpos,ringkeypos,ringkeypktlen,out)) < 0)
  606.                                         return(status);
  607.                                 copying = FALSE;
  608.                         }
  609. diff -c .bk/keymgmt.c ./keymgmt.c
  610. *** .bk/keymgmt.c       Wed Jun 23 16:53:54 1993
  611. --- ./keymgmt.c Thu May 19 00:20:47 1994
  612. ***************
  613. *** 824,830 ****
  614.  
  615.  
  616.   int getpubusersig(char *keyfile, long user_position, byte *sigkeyID,
  617. !       long *sig_position, int *sig_len)
  618.   /*  Start at user_position in keyfile, and scan for the signature packet
  619.         that matches sigkeyID.  Return sig_position and sig_len.
  620.         Return 0 if OK, -1 on error.
  621. --- 824,830 ----
  622.  
  623.  
  624.   int getpubusersig(char *keyfile, long user_position, byte *sigkeyID,
  625. !       byte *timestamp, long *sig_position, int *sig_len)
  626.   /*  Start at user_position in keyfile, and scan for the signature packet
  627.         that matches sigkeyID.  Return sig_position and sig_len.
  628.         Return 0 if OK, -1 on error.
  629. ***************
  630. *** 857,862 ****
  631. --- 857,865 ----
  632.                 {       if (equal_buffers(sigkeyID,keyID0,KEYFRAGSIZE))
  633.                         {       *sig_position = fpos;
  634.                                 *sig_len = ( int ) ( ftell(f) - fpos );
  635. +                               fseek(f, fpos+6, SEEK_SET);
  636. +                               fread(timestamp,1,SIZEOF_TIMESTAMP,f);  /* read certificate timestamp */
  637. +                               convert_byteorder(timestamp,SIZEOF_TIMESTAMP); /* convert from external form */
  638.                                 fclose(f);
  639.                                 return(0);      /* normal return */
  640.                         }
  641. diff -c .bk/keymgmt.h ./keymgmt.h
  642. *** .bk/keymgmt.h       Fri Jun 11 09:57:56 1993
  643. --- ./keymgmt.h Wed May 18 18:23:46 1994
  644. ***************
  645. *** 80,86 ****
  646.         long *userid_position, int *userid_len, boolean exact_match);
  647.  
  648.   int getpubusersig(char *keyfile, long user_position, byte *sigkeyID,
  649. !       long *sig_position, int *sig_len);
  650.  
  651.   void getKeyHash( byte *hash, unitptr n, unitptr e );
  652.   void printKeyHash( byteptr hash, boolean indent );
  653. --- 80,86 ----
  654.         long *userid_position, int *userid_len, boolean exact_match);
  655.  
  656.   int getpubusersig(char *keyfile, long user_position, byte *sigkeyID,
  657. !       byte *timestamp, long *sig_position, int *sig_len);
  658.  
  659.   void getKeyHash( byte *hash, unitptr n, unitptr e );
  660.   void printKeyHash( byteptr hash, boolean indent );
  661.