From 15a2a3cd1f41b666bff3e2610474d561f203893a Mon Sep 17 00:00:00 2001 From: Timo Schulz Date: Sun, 22 Dec 2002 20:53:20 +0000 Subject: [PATCH] 2002-12-22 Timo Schulz * import.c (print_import_check): New. (import_one): Use it here. Use merge_keys_and_selfsig in the interactive mode to avoid wrong key information. * status.h: Add new status code. * status.c: Ditto. --- g10/ChangeLog | 9 +++++++++ g10/import.c | 27 +++++++++++++++++++++++++++ g10/status.c | 1 + g10/status.h | 1 + 4 files changed, 38 insertions(+) diff --git a/g10/ChangeLog b/g10/ChangeLog index 84f3c5945..526664306 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,12 @@ +2002-12-22 Timo Schulz + + * import.c (print_import_check): New. + (import_one): Use it here. + Use merge_keys_and_selfsig in the interactive mode to avoid + wrong key information. + * status.h: Add new status code. + * status.c: Ditto. + 2002-12-13 David Shaw * pkclist.c (do_we_trust): Tweak language to refer to the "named diff --git a/g10/import.c b/g10/import.c index f0df0e1d5..f06799df0 100644 --- a/g10/import.c +++ b/g10/import.c @@ -556,6 +556,31 @@ print_import_ok (PKT_public_key *pk, PKT_secret_key *sk, unsigned int reason) } +void +print_import_check (PKT_public_key * pk, PKT_user_id * id) +{ + char * buf, * p; + byte fpr[24]; + u32 keyid[2]; + int i, pos = 0, n; + + buf = m_alloc (17+41+id->len+32); + keyid_from_pk (pk, keyid); + sprintf (buf, "%08X%08X ", keyid[0], keyid[1]); + pos = 17; + fingerprint_from_pk (pk, fpr, &n); + for (i = 0; i < n; i++, pos += 2) + sprintf (buf+pos, "%02X", fpr[i]); + strcat (buf, " "); + pos += 1; + p = native_to_utf8 (id->name); + strcat (buf, p); + write_status_text (STATUS_IMPORT_CHECK, buf); + m_free (buf); + m_free (p); +} + + /**************** * Try to import one keyblock. Return an error only in serious cases, but * never for an invalid keyblock. It uses log_error to increase the @@ -605,6 +630,8 @@ import_one( const char *fname, KBNODE keyblock, } if (opt.interactive) { + print_import_check (pk, uidnode->pkt->pkt.user_id); + merge_keys_and_selfsig (keyblock); tty_printf ("\n"); show_basic_key_info (keyblock); tty_printf ("\n"); diff --git a/g10/status.c b/g10/status.c index 799b42edc..b665968f0 100644 --- a/g10/status.c +++ b/g10/status.c @@ -121,6 +121,7 @@ get_status_string ( int no ) case STATUS_ERRMDC : s = "ERRMDC"; break; case STATUS_IMPORTED : s = "IMPORTED"; break; case STATUS_IMPORT_OK : s = "IMPORT_OK"; break; + case STATUS_IMPORT_CHECK : s = "IMPORT_CHECK"; break; case STATUS_IMPORT_RES : s = "IMPORT_RES"; break; case STATUS_FILE_START : s = "FILE_START"; break; case STATUS_FILE_DONE : s = "FILE_DONE"; break; diff --git a/g10/status.h b/g10/status.h index dd913b4bd..44a7d6d32 100644 --- a/g10/status.h +++ b/g10/status.h @@ -98,6 +98,7 @@ #define STATUS_EXPKEYSIG 66 #define STATUS_ATTRIBUTE 67 #define STATUS_IMPORT_OK 68 +#define STATUS_IMPORT_CHECK 69 /*-- status.c --*/ void set_status_fd ( int fd );