aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2021-08-12 08:47:34 +0000
committerIngo Klöcker <[email protected]>2021-08-12 08:50:33 +0000
commit99601778f4a9dc1c9fee792361c959f5e0732cfd (patch)
tree84363a4e4389b824fd04d9ce817b92fc79dbd2c7
parentw32: Move socketdir to LCOAL_APPDATA (diff)
downloadgnupg-99601778f4a9dc1c9fee792361c959f5e0732cfd.tar.gz
gnupg-99601778f4a9dc1c9fee792361c959f5e0732cfd.zip
agent: Make --pinentry-formatted-passphrase a simple flag
* agent/agent.h (opt): Change type of pinentry_formatted_passphrase to int (as for other flags). * agent/call-pinentry.c (setup_formatted_passphrase): Remove no longer needed translated strings. Write option without value to Assuan connection. * agent/gpg-agent.c (opts): Use ARGPARSE_s_n for oPinentryFormattedPassphrase. (parse_rereadable_options): Set option to 1. -- GnuPG-bug-id: 5553, 5517
-rw-r--r--agent/agent.h9
-rw-r--r--agent/call-pinentry.c13
-rw-r--r--agent/gpg-agent.c4
-rw-r--r--doc/gpg-agent.texi21
4 files changed, 8 insertions, 39 deletions
diff --git a/agent/agent.h b/agent/agent.h
index fb2adde79..23982626d 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -108,13 +108,8 @@ struct
upon this timeout value. */
unsigned long pinentry_timeout;
- /* Mode for the formatted passphrase option to use by pinentry.
- Possible values are:
- 0 - Option is not shown (and off).
- 1 - Option is shown, off by default, and user can change it.
- 2 - Option is shown, on, and user cannot change it.
- 3 - Option is shown, on by default, and user can change it. */
- unsigned int pinentry_formatted_passphrase;
+ /* If set, then passphrase formatting is enabled in pinentry. */
+ int pinentry_formatted_passphrase;
/* The default and maximum TTL of cache entries. */
unsigned long def_cache_ttl; /* Default. */
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index 9842408ec..ed37363da 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -1029,16 +1029,6 @@ static gpg_error_t
setup_formatted_passphrase (ctrl_t ctrl)
{
static const struct { const char *key, *help_id, *value; } tbl[] = {
- /* TRANSLATORS: This is the text of an option (usually represented
- by a checkbox) as used in pinentry. */
- { "label", "pinentry.formatted_passphrase.label",
- N_("Format the passphrase") },
- /* TRANSLATORS: This is the tooltip shown by pinentry when
- hovering over the option for formatted passphrase.
- The length is limited to about 900 characters. */
- { "tt", "pinentry.formatted_passphrase.tooltip",
- N_("Enable this option to make the passphrase easier readable by "
- "grouping its characters.") },
/* TRANSLATORS: This is a text shown by pinentry if the option
for formatted passphrase is enabled. The length is
limited to about 900 characters. */
@@ -1057,8 +1047,7 @@ setup_formatted_passphrase (ctrl_t ctrl)
if (opt.pinentry_formatted_passphrase)
{
- snprintf (line, DIM(line), "OPTION formatted-passphrase=%d",
- opt.pinentry_formatted_passphrase);
+ snprintf (line, DIM(line), "OPTION formatted-passphrase");
rc = assuan_transact (entry_ctx, line, NULL, NULL, NULL, NULL, NULL,
NULL);
if (rc && gpg_err_code (rc) != GPG_ERR_UNKNOWN_OPTION)
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index edc21f4d9..30d7cebaa 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -285,7 +285,7 @@ static gpgrt_opt_t opts[] = {
ARGPARSE_s_s (oPinentryInvisibleChar, "pinentry-invisible-char", "@"),
ARGPARSE_s_u (oPinentryTimeout, "pinentry-timeout",
N_("|N|set the Pinentry timeout to N seconds")),
- ARGPARSE_s_u (oPinentryFormattedPassphrase, "pinentry-formatted-passphrase",
+ ARGPARSE_s_n (oPinentryFormattedPassphrase, "pinentry-formatted-passphrase",
"@"),
ARGPARSE_s_n (oAllowEmacsPinentry, "allow-emacs-pinentry",
N_("allow passphrase to be prompted through Emacs")),
@@ -914,7 +914,7 @@ parse_rereadable_options (gpgrt_argparse_t *pargs, int reread)
break;
case oPinentryTimeout: opt.pinentry_timeout = pargs->r.ret_ulong; break;
case oPinentryFormattedPassphrase:
- opt.pinentry_formatted_passphrase = pargs->r.ret_ulong;
+ opt.pinentry_formatted_passphrase = 1;
break;
case oTpm2daemonProgram:
diff --git a/doc/gpg-agent.texi b/doc/gpg-agent.texi
index e83dc6268..a061283d6 100644
--- a/doc/gpg-agent.texi
+++ b/doc/gpg-agent.texi
@@ -465,25 +465,10 @@ user input. The default value of 0 does not ask the pinentry to
timeout, however a Pinentry may use its own default timeout value in
this case. A Pinentry may or may not honor this request.
-@item --pinentry-formatted-passphrase @var{n}
+@item --pinentry-formatted-passphrase
@opindex pinentry-formatted-passphrase
-This option asks the Pinentry to use the mode @var{n} for passphrase
-formatting when asking the user for a new passphrase.
-Possible values are:
-@table @code
-@item 0
-Passphrase formatting is disabled. The option to change it is not shown,
-so that the user cannot turn it on. This is the default.
-@item 1
-Passphrase formatting is disabled. The option to change it is shown, so
-that the user can turn it on.
-@item 2
-Passphrase formatting is enabled. The option to change it is shown, but
-disabled, so that the user cannot turn it off.
-@item 3
-Passphrase formatting is enabled. The option to change it is shown, so
-that the user can turn it off.
-@end table
+This option asks the Pinentry to enable passphrase formatting when asking the
+user for a new passphrase and masking of the passphrase is turned off.
If passphrase formatting is enabled, then all non-breaking space characters
are stripped from the entered passphrase. Passphrase formatting is mostly