mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Allow for positional parameters in the passphrase prompt.
* g10/passphrase.c (passphrase_get): Replace sprintf by xasprintf. -- Without that at least the French translation does not always work because it requires positional parameters. Windows for example does not support them as they are not defined by C99 but by POSIX.
This commit is contained in:
parent
cb680c5ea5
commit
a731c22952
@ -265,38 +265,27 @@ passphrase_get ( u32 *keyid, int mode, const char *cacheid, int repeat,
|
|||||||
if ( !algo_name )
|
if ( !algo_name )
|
||||||
algo_name = "?";
|
algo_name = "?";
|
||||||
|
|
||||||
#define KEYIDSTRING _(" (main key ID %s)")
|
if (keyid[2] && keyid[3]
|
||||||
|
&& keyid[0] != keyid[2]
|
||||||
maink = xmalloc ( strlen (KEYIDSTRING) + keystrlen() + 20 );
|
|
||||||
if( keyid[2] && keyid[3] && keyid[0] != keyid[2]
|
|
||||||
&& keyid[1] != keyid[3] )
|
&& keyid[1] != keyid[3] )
|
||||||
sprintf( maink, KEYIDSTRING, keystr(&keyid[2]) );
|
maink = xasprintf (_(" (main key ID %s)"), keystr (&keyid[2]));
|
||||||
else
|
else
|
||||||
*maink = 0;
|
maink = xstrdup ("");
|
||||||
|
|
||||||
uid = get_user_id ( keyid, &uidlen );
|
uid = get_user_id ( keyid, &uidlen );
|
||||||
timestr = strtimestamp (pk->timestamp);
|
timestr = strtimestamp (pk->timestamp);
|
||||||
|
|
||||||
#undef KEYIDSTRING
|
atext = xasprintf (_("Please enter the passphrase to unlock the"
|
||||||
|
" secret key for the OpenPGP certificate:\n"
|
||||||
#define PROMPTSTRING _("Please enter the passphrase to unlock the" \
|
"\"%.*s\"\n"
|
||||||
" secret key for the OpenPGP certificate:\n" \
|
"%u-bit %s key, ID %s,\n"
|
||||||
"\"%.*s\"\n" \
|
"created %s%s.\n"),
|
||||||
"%u-bit %s key, ID %s,\n" \
|
(int)uidlen, uid,
|
||||||
"created %s%s.\n" )
|
nbits_from_pk (pk), algo_name, keystr(&keyid[0]),
|
||||||
|
timestr, maink);
|
||||||
atext = xmalloc ( 100 + strlen (PROMPTSTRING)
|
|
||||||
+ uidlen + 15 + strlen(algo_name) + keystrlen()
|
|
||||||
+ strlen (timestr) + strlen (maink) );
|
|
||||||
sprintf (atext, PROMPTSTRING,
|
|
||||||
(int)uidlen, uid,
|
|
||||||
nbits_from_pk (pk), algo_name, keystr(&keyid[0]), timestr,
|
|
||||||
maink );
|
|
||||||
xfree (uid);
|
xfree (uid);
|
||||||
xfree (maink);
|
xfree (maink);
|
||||||
|
|
||||||
#undef PROMPTSTRING
|
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t dummy;
|
size_t dummy;
|
||||||
fingerprint_from_pk( pk, fpr, &dummy );
|
fingerprint_from_pk( pk, fpr, &dummy );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user