From 2dfec7107c626319e30465cfddacd64607477f20 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Mon, 6 May 2002 16:40:33 +0000 Subject: [PATCH] * keyedit.c (sign_uids): Convert uids from UTF8 to native before printing. (menu_set_primary_uid): Show error if the user tries to make a uid with a v3 self-sig primary. --- g10/ChangeLog | 6 ++++++ g10/keyedit.c | 36 ++++++++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 52188192d..7b49c5842 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,9 @@ +2002-05-06 David Shaw + + * keyedit.c (sign_uids): Convert uids from UTF8 to native before + printing. (menu_set_primary_uid): Show error if the user tries to + make a uid with a v3 self-sig primary. + 2002-05-05 David Shaw * import.c (import_one): When merging with a key we already have, diff --git a/g10/keyedit.c b/g10/keyedit.c index 75c28c41a..163f3473b 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -335,8 +335,13 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified, uidnode = (node->flag & NODFLG_MARK_A)? node : NULL; if(uidnode && uidnode->pkt->pkt.user_id->is_revoked) { - tty_printf(_("User ID \"%s\" is revoked."), - uidnode->pkt->pkt.user_id->name); + char *user=utf8_to_native(uidnode->pkt->pkt.user_id->name, + uidnode->pkt->pkt.user_id->len, + 0); + + tty_printf(_("User ID \"%s\" is revoked."),user); + + m_free(user); if(opt.expert) { @@ -359,14 +364,17 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified, if( sk_keyid[0] == node->pkt->pkt.signature->keyid[0] && sk_keyid[1] == node->pkt->pkt.signature->keyid[1] ) { char buf[50]; + char *user=utf8_to_native(uidnode->pkt->pkt.user_id->name, + uidnode->pkt->pkt.user_id->len, + 0); if(!node->pkt->pkt.signature->flags.exportable && !local) { /* It's a local sig, and we want to make a exportable sig. */ tty_printf(_("Your current signature on \"%s\"\n" - "is a local signature.\n"), - uidnode->pkt->pkt.user_id->name); + "is a local signature.\n"),user); + if(cpr_get_answer_is_yes("sign_uid.promote_okay", _("Do you want to promote " "it to a full exportable " @@ -389,17 +397,17 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified, if (!node->pkt->pkt.signature->flags.exportable && local) tty_printf(_( "\"%s\" was already locally signed by key %08lX\n"), - uidnode->pkt->pkt.user_id->name, - (ulong)sk_keyid[1] ); + user,(ulong)sk_keyid[1] ); else tty_printf(_( "\"%s\" was already signed by key %08lX\n"), - uidnode->pkt->pkt.user_id->name, - (ulong)sk_keyid[1] ); + user,(ulong)sk_keyid[1] ); sprintf (buf, "%08lX%08lX", (ulong)sk->keyid[0], (ulong)sk->keyid[1] ); write_status_text (STATUS_ALREADY_SIGNED, buf); uidnode->flag &= ~NODFLG_MARK_A; /* remove mark */ + + m_free(user); } } } @@ -2108,8 +2116,15 @@ menu_set_primary_uid ( KBNODE pub_keyblock, KBNODE sec_keyblock ) PKT_signature *sig = node->pkt->pkt.signature; if ( keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1] && (uid && (sig->sig_class&~3) == 0x10) - && sig->version >= 4 && attribute == (uid->attrib_data!=NULL)) { + if(sig->version < 4) { + char *user=utf8_to_native(uid->name,strlen(uid->name),0); + + log_info(_("skipping v3 self-signature on user id \"%s\"\n"), + user); + m_free(user); + } + else { /* This is a selfsignature which is to be replaced. We can just ignore v3 signatures because they are not able to carry the primary ID flag. We also @@ -2158,7 +2173,8 @@ menu_set_primary_uid ( KBNODE pub_keyblock, KBNODE sec_keyblock ) m_free( node->pkt ); node->pkt = newpkt; modified = 1; - } + } + } } } }