mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Fix bug#1122.
Note that msgmerge 0.17 is completely broken as it always prepends a fuzzy null entry to all po files.
This commit is contained in:
parent
deba82bd76
commit
35ab964c86
33 changed files with 1767 additions and 1619 deletions
|
@ -1,5 +1,14 @@
|
|||
2009-09-03 Werner Koch <wk@g10code.com>
|
||||
|
||||
* keyedit.c (menu_adduid): Pass keyblock to generate_user_id.
|
||||
* keygen.c (generate_user_id): Add arg KEYBLOCK. Factor code out
|
||||
to ...
|
||||
(uid_from_string): ... new.
|
||||
(ask_user_id): Add arg KEYBLOCK and check for duplicates. Fix
|
||||
bug#1122.
|
||||
|
||||
* Makefile.am (uninstall-local): New.
|
||||
|
||||
* compress-bz2.c (do_uncompress): Detect unexpected EOF. Fix
|
||||
bug#1011.
|
||||
|
||||
|
|
|
@ -137,3 +137,5 @@ install-data-local:
|
|||
$(INSTALL_DATA) $(srcdir)/options.skel \
|
||||
$(DESTDIR)$(pkgdatadir)/gpg-conf.skel
|
||||
|
||||
uninstall-local:
|
||||
-@rm $(DESTDIR)$(pkgdatadir)/gpg-conf.skel
|
||||
|
|
|
@ -3073,7 +3073,7 @@ menu_adduid( KBNODE pub_keyblock, KBNODE sec_keyblock,
|
|||
|
||||
uid = generate_photo_id(pk,photo_name);
|
||||
} else
|
||||
uid = generate_user_id();
|
||||
uid = generate_user_id (pub_keyblock);
|
||||
if( !uid )
|
||||
return 0;
|
||||
|
||||
|
|
72
g10/keygen.c
72
g10/keygen.c
|
@ -2017,8 +2017,28 @@ ask_expiredate()
|
|||
}
|
||||
|
||||
|
||||
|
||||
static PKT_user_id *
|
||||
uid_from_string (const char *string)
|
||||
{
|
||||
size_t n;
|
||||
PKT_user_id *uid;
|
||||
|
||||
n = strlen (string);
|
||||
uid = xmalloc_clear (sizeof *uid + n);
|
||||
uid->len = n;
|
||||
strcpy (uid->name, string);
|
||||
uid->ref = 1;
|
||||
return uid;
|
||||
}
|
||||
|
||||
|
||||
/* Ask for a user ID. With a MODE of 1 an extra help prompt is
|
||||
printed for use during a new key creation. If KEYBLOCK is not NULL
|
||||
the function prevents the creation of an already existing user
|
||||
ID. */
|
||||
static char *
|
||||
ask_user_id( int mode )
|
||||
ask_user_id (int mode, KBNODE keyblock)
|
||||
{
|
||||
char *answer;
|
||||
char *aname, *acomment, *amail, *uid;
|
||||
|
@ -2134,14 +2154,29 @@ ask_user_id( int mode )
|
|||
}
|
||||
|
||||
tty_printf(_("You selected this USER-ID:\n \"%s\"\n\n"), uid);
|
||||
/* fixme: add a warning if this user-id already exists */
|
||||
|
||||
if( !*amail && !opt.allow_freeform_uid
|
||||
&& (strchr( aname, '@' ) || strchr( acomment, '@'))) {
|
||||
fail = 1;
|
||||
tty_printf(_("Please don't put the email address "
|
||||
"into the real name or the comment\n") );
|
||||
tty_printf(_("Please don't put the email address "
|
||||
"into the real name or the comment\n") );
|
||||
}
|
||||
|
||||
if (!fail && keyblock)
|
||||
{
|
||||
PKT_user_id *uidpkt = uid_from_string (uid);
|
||||
KBNODE node;
|
||||
|
||||
for (node=keyblock; node && !fail; node=node->next)
|
||||
if (!is_deleted_kbnode (node)
|
||||
&& node->pkt->pkttype == PKT_USER_ID
|
||||
&& !cmp_user_ids (uidpkt, node->pkt->pkt.user_id))
|
||||
fail = 1;
|
||||
if (fail)
|
||||
tty_printf (_("Such a user ID already exists on this key!\n"));
|
||||
free_user_id (uidpkt);
|
||||
}
|
||||
|
||||
for(;;) {
|
||||
/* TRANSLATORS: These are the allowed answers in
|
||||
lower and uppercase. Below you will find the matching
|
||||
|
@ -2296,25 +2331,18 @@ do_create (int algo, unsigned int nbits, KBNODE pub_root, KBNODE sec_root,
|
|||
}
|
||||
|
||||
|
||||
/****************
|
||||
* Generate a new user id packet, or return NULL if canceled
|
||||
*/
|
||||
/* Generate a new user id packet or return NULL if canceled. If
|
||||
KEYBLOCK is not NULL the function prevents the creation of an
|
||||
already existing user ID. */
|
||||
PKT_user_id *
|
||||
generate_user_id()
|
||||
generate_user_id (KBNODE keyblock)
|
||||
{
|
||||
PKT_user_id *uid;
|
||||
char *p;
|
||||
size_t n;
|
||||
|
||||
p = ask_user_id( 1 );
|
||||
if( !p )
|
||||
return NULL;
|
||||
n = strlen(p);
|
||||
uid = xmalloc_clear( sizeof *uid + n );
|
||||
uid->len = n;
|
||||
strcpy(uid->name, p);
|
||||
uid->ref = 1;
|
||||
return uid;
|
||||
char *p;
|
||||
|
||||
p = ask_user_id (1, keyblock);
|
||||
if (!p)
|
||||
return NULL; /* Canceled. */
|
||||
return uid_from_string (p);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3143,7 +3171,7 @@ generate_keypair (const char *fname, const char *card_serialno,
|
|||
r->next = para;
|
||||
para = r;
|
||||
|
||||
uid = ask_user_id(0);
|
||||
uid = ask_user_id (0, NULL);
|
||||
if( !uid )
|
||||
{
|
||||
log_error(_("Key generation canceled.\n"));
|
||||
|
|
|
@ -509,6 +509,6 @@ int update_keysig_packet( PKT_signature **ret_sig,
|
|||
void *opaque );
|
||||
|
||||
/*-- keygen.c --*/
|
||||
PKT_user_id *generate_user_id(void);
|
||||
PKT_user_id *generate_user_id (KBNODE keyblock);
|
||||
|
||||
#endif /*G10_PACKET_H*/
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
#include "ttyio.h"
|
||||
#include "trustdb.h"
|
||||
|
||||
/* Generate a new photo id packet, or return NULL if canceled */
|
||||
/* Generate a new photo id packet, or return NULL if canceled.
|
||||
FIXME: Should we add a duplicates check similar to generate_user_id? */
|
||||
PKT_user_id *
|
||||
generate_photo_id(PKT_public_key *pk,const char *photo_name)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue