[svn] GnuPG - r5147 - in trunk: g10 po
svn author wk
cvs at cvs.gnupg.org
Thu Sep 3 22:51:59 CEST 2009
Author: wk
Date: 2009-09-03 22:51:55 +0200 (Thu, 03 Sep 2009)
New Revision: 5147
Modified:
trunk/g10/ChangeLog
trunk/g10/Makefile.am
trunk/g10/keyedit.c
trunk/g10/keygen.c
trunk/g10/packet.h
trunk/g10/photoid.c
trunk/po/be.po
trunk/po/ca.po
trunk/po/cs.po
trunk/po/da.po
trunk/po/de.po
trunk/po/el.po
trunk/po/eo.po
trunk/po/es.po
trunk/po/et.po
trunk/po/fi.po
trunk/po/fr.po
trunk/po/gl.po
trunk/po/hu.po
trunk/po/id.po
trunk/po/it.po
trunk/po/ja.po
trunk/po/nb.po
trunk/po/pl.po
trunk/po/pt.po
trunk/po/pt_BR.po
trunk/po/ro.po
trunk/po/ru.po
trunk/po/sk.po
trunk/po/sv.po
trunk/po/tr.po
trunk/po/zh_CN.po
trunk/po/zh_TW.po
Log:
Fix bug#1122.
Note that msgmerge 0.17 is completely broken as it always
prepends a fuzzy null entry to all po files.
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2009-09-03 15:27:30 UTC (rev 5146)
+++ trunk/g10/ChangeLog 2009-09-03 20:51:55 UTC (rev 5147)
@@ -1,5 +1,14 @@
2009-09-03 Werner Koch <wk at 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.
Modified: trunk/g10/Makefile.am
===================================================================
--- trunk/g10/Makefile.am 2009-09-03 15:27:30 UTC (rev 5146)
+++ trunk/g10/Makefile.am 2009-09-03 20:51:55 UTC (rev 5147)
@@ -137,3 +137,5 @@
$(INSTALL_DATA) $(srcdir)/options.skel \
$(DESTDIR)$(pkgdatadir)/gpg-conf.skel
+uninstall-local:
+ - at rm $(DESTDIR)$(pkgdatadir)/gpg-conf.skel
Modified: trunk/g10/keyedit.c
===================================================================
--- trunk/g10/keyedit.c 2009-09-03 15:27:30 UTC (rev 5146)
+++ trunk/g10/keyedit.c 2009-09-03 20:51:55 UTC (rev 5147)
@@ -3073,7 +3073,7 @@
uid = generate_photo_id(pk,photo_name);
} else
- uid = generate_user_id();
+ uid = generate_user_id (pub_keyblock);
if( !uid )
return 0;
Modified: trunk/g10/keygen.c
===================================================================
--- trunk/g10/keygen.c 2009-09-03 15:27:30 UTC (rev 5146)
+++ trunk/g10/keygen.c 2009-09-03 20:51:55 UTC (rev 5147)
@@ -2017,8 +2017,28 @@
}
+
+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 @@
}
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 @@
}
-/****************
- * 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 @@
r->next = para;
para = r;
- uid = ask_user_id(0);
+ uid = ask_user_id (0, NULL);
if( !uid )
{
log_error(_("Key generation canceled.\n"));
Modified: trunk/g10/packet.h
===================================================================
--- trunk/g10/packet.h 2009-09-03 15:27:30 UTC (rev 5146)
+++ trunk/g10/packet.h 2009-09-03 20:51:55 UTC (rev 5147)
@@ -509,6 +509,6 @@
void *opaque );
/*-- keygen.c --*/
-PKT_user_id *generate_user_id(void);
+PKT_user_id *generate_user_id (KBNODE keyblock);
#endif /*G10_PACKET_H*/
Modified: trunk/g10/photoid.c
===================================================================
--- trunk/g10/photoid.c 2009-09-03 15:27:30 UTC (rev 5146)
+++ trunk/g10/photoid.c 2009-09-03 20:51:55 UTC (rev 5147)
@@ -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)
{
Modified: trunk/po/be.po [not shown]
Modified: trunk/po/ca.po [not shown]
Modified: trunk/po/cs.po [not shown]
Modified: trunk/po/da.po [not shown]
Modified: trunk/po/de.po [not shown]
Modified: trunk/po/el.po [not shown]
Modified: trunk/po/eo.po [not shown]
Modified: trunk/po/es.po [not shown]
Modified: trunk/po/et.po [not shown]
Modified: trunk/po/fi.po [not shown]
Modified: trunk/po/fr.po [not shown]
Modified: trunk/po/gl.po [not shown]
Modified: trunk/po/hu.po [not shown]
Modified: trunk/po/id.po [not shown]
Modified: trunk/po/it.po [not shown]
Modified: trunk/po/ja.po [not shown]
Modified: trunk/po/nb.po [not shown]
Modified: trunk/po/pl.po [not shown]
Modified: trunk/po/pt.po [not shown]
Modified: trunk/po/pt_BR.po [not shown]
Modified: trunk/po/ro.po [not shown]
Modified: trunk/po/ru.po [not shown]
Modified: trunk/po/sk.po [not shown]
Modified: trunk/po/sv.po [not shown]
Modified: trunk/po/tr.po [not shown]
Modified: trunk/po/zh_CN.po [not shown]
Modified: trunk/po/zh_TW.po [not shown]
More information about the Gnupg-commits
mailing list