--- pgp/src/keyadd.c 2018/04/24 16:39:40 1.1.1.3 +++ pgp/src/keyadd.c 2018/04/24 16:40:30 1.1.1.4 @@ -46,6 +46,7 @@ static boolean ask_first; static boolean publickey; /* if TRUE, add trust packets */ static int newkeys, newsigs, newids, newrvks; +static byte mykeyID[KEYFRAGSIZE]; static int mergesigs (FILE *fkey, char *keyfile, long keypos, FILE *fring, char *ringfile, long *pringpos, FILE *out) @@ -130,6 +131,8 @@ static int mergesigs (FILE *fkey, char * fprintf(pgpout, PSTR("on userid \"%s\"\n"), LOCAL_CHARSET(userid)); } ++newsigs; + if (batchmode) + show_update(keyIDstring(mykeyID)); } } if (copying && is_ctb_type(ctb,CTB_SKE_TYPE)) @@ -214,10 +217,13 @@ static int mergekeys (FILE *fkey, char * fprintf(pgpout, PSTR("Key revocation certificate from \"%s\".\n"), LOCAL_CHARSET((char *)userid)); copyfilepos (fkey, out, cert_pktlen, keypos); + /* Show updates */ + if (batchmode) + show_key(fring, *pringpos, SHOW_CHANGE); ++newrvks; } else - fprintf(pgpout, PSTR("\n\007WARNING: File '%s' contains bad revocation certificate.\n")); + fprintf(pgpout, PSTR("\n\007WARNING: File '%s' contains bad revocation certificate.\n"), keyfile); } fseek (fkey, keypos, SEEK_SET); @@ -256,8 +262,14 @@ static int mergekeys (FILE *fkey, char * fprintf(pgpout, PSTR("\nWill be added to the following key:\n")); show_key(fring, *pringpos, 0); fprintf(pgpout, PSTR("\nAdd this userid (y/N)? ")); - if (batchmode || getyesno('n')) + if (batchmode || getyesno('n')) { ++newids; + /* Show an update string */ + if (batchmode) { + fprintf(pgpout, "\n"); + show_key(fring, *pringpos, SHOW_CHANGE); + } + } else copying = FALSE; } @@ -279,6 +291,10 @@ static int mergekeys (FILE *fkey, char * * plus its dependant signatures. */ fseek (fring, ringpos, SEEK_SET); + /* Grab the keyID here */ + readkeypacket(fring,FALSE,&ctb,NULL,(char *)userid,NULL,NULL, + NULL,NULL,NULL,NULL,NULL,NULL); + fseek (fring, ringpos, SEEK_SET); for ( ; ; ) { ringpos = ftell(fring); status = readkeypacket(fring,FALSE,&ctb,NULL,(char *)userid,NULL,NULL, @@ -444,6 +460,9 @@ Acknowledge by pressing return: "), keyI copying = TRUE; } + /* If batchmode, output an update message */ + if (batchmode) + show_key(f, file_position, SHOW_CHANGE); if (copying) { nkey = xmalloc(sizeof(struct nkey)); @@ -526,6 +545,7 @@ Acknowledge by pressing return: "), keyI { /* See if there is a match in keyfile */ extract_keyID(keyID, n); /* from ringfile, not keyfile */ + extract_keyID(mykeyID, n); /* save this */ publickey = is_ctb_type(ctb, CTB_CERT_PUBKEY_TYPE); if (get_publickey(&tfp, NULL, keyID, timestamp, userid1, n1, e) >= 0) { @@ -694,7 +714,10 @@ static int ask_to_sign(byte *keyID, char { fprintf(pgpout, PSTR("\nOne or more of the new keys are not fully certified.\n\ Do you want to certify any of these keys yourself (y/N)? ")); if (!getyesno('n')) + { + fclose(f); return 1; + } } ask_first = FALSE; show_key(f, fpos, SHOW_ALL|SHOW_HASH);