1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-24 10:39:57 +01:00

* 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.
This commit is contained in:
David Shaw 2002-05-06 16:40:33 +00:00
parent ffc98f20ea
commit 2dfec7107c
2 changed files with 32 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2002-05-06 David Shaw <dshaw@jabberwocky.com>
* 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 <dshaw@jabberwocky.com> 2002-05-05 David Shaw <dshaw@jabberwocky.com>
* import.c (import_one): When merging with a key we already have, * import.c (import_one): When merging with a key we already have,

View File

@ -335,8 +335,13 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
uidnode = (node->flag & NODFLG_MARK_A)? node : NULL; uidnode = (node->flag & NODFLG_MARK_A)? node : NULL;
if(uidnode && uidnode->pkt->pkt.user_id->is_revoked) if(uidnode && uidnode->pkt->pkt.user_id->is_revoked)
{ {
tty_printf(_("User ID \"%s\" is revoked."), char *user=utf8_to_native(uidnode->pkt->pkt.user_id->name,
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) 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] if( sk_keyid[0] == node->pkt->pkt.signature->keyid[0]
&& sk_keyid[1] == node->pkt->pkt.signature->keyid[1] ) { && sk_keyid[1] == node->pkt->pkt.signature->keyid[1] ) {
char buf[50]; 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) if(!node->pkt->pkt.signature->flags.exportable && !local)
{ {
/* It's a local sig, and we want to make a /* It's a local sig, and we want to make a
exportable sig. */ exportable sig. */
tty_printf(_("Your current signature on \"%s\"\n" tty_printf(_("Your current signature on \"%s\"\n"
"is a local signature.\n"), "is a local signature.\n"),user);
uidnode->pkt->pkt.user_id->name);
if(cpr_get_answer_is_yes("sign_uid.promote_okay", if(cpr_get_answer_is_yes("sign_uid.promote_okay",
_("Do you want to promote " _("Do you want to promote "
"it to a full exportable " "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) if (!node->pkt->pkt.signature->flags.exportable && local)
tty_printf(_( tty_printf(_(
"\"%s\" was already locally signed by key %08lX\n"), "\"%s\" was already locally signed by key %08lX\n"),
uidnode->pkt->pkt.user_id->name, user,(ulong)sk_keyid[1] );
(ulong)sk_keyid[1] );
else else
tty_printf(_( tty_printf(_(
"\"%s\" was already signed by key %08lX\n"), "\"%s\" was already signed by key %08lX\n"),
uidnode->pkt->pkt.user_id->name, user,(ulong)sk_keyid[1] );
(ulong)sk_keyid[1] );
sprintf (buf, "%08lX%08lX", sprintf (buf, "%08lX%08lX",
(ulong)sk->keyid[0], (ulong)sk->keyid[1] ); (ulong)sk->keyid[0], (ulong)sk->keyid[1] );
write_status_text (STATUS_ALREADY_SIGNED, buf); write_status_text (STATUS_ALREADY_SIGNED, buf);
uidnode->flag &= ~NODFLG_MARK_A; /* remove mark */ 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; PKT_signature *sig = node->pkt->pkt.signature;
if ( keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1] if ( keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1]
&& (uid && (sig->sig_class&~3) == 0x10) && (uid && (sig->sig_class&~3) == 0x10)
&& sig->version >= 4
&& attribute == (uid->attrib_data!=NULL)) { && 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. /* This is a selfsignature which is to be replaced.
We can just ignore v3 signatures because they are We can just ignore v3 signatures because they are
not able to carry the primary ID flag. We also 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 ); m_free( node->pkt );
node->pkt = newpkt; node->pkt = newpkt;
modified = 1; modified = 1;
} }
}
} }
} }
} }