[PATCH 2/2] agent: Disable quality bar by default.
Damien Goutte-Gattat
dgouttegattat at incenp.org
Sat Dec 30 11:19:25 CET 2017
* agent/call-pinentry.c (SHOW_QUALITYBAR): New symbol.
(agent_askpin): Request a quality bar only if meaningful.
(agent_get_passphrase): Likewise.
--
We should ask Pinentry to display a quality bar only if we have a
decent way (provided by the --passphrase-quality-checker option)
of estimating the quality of the passphrase, or if we check the
passphrase against a list of patterns (--check-passphrase-pattern).
Signed-off-by: Damien Goutte-Gattat <dgouttegattat at incenp.org>
---
agent/call-pinentry.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index 1d971db6f..7e878df12 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -54,6 +54,12 @@
time. */
#define LOCK_TIMEOUT (1*60)
+/* We ask Pinentry to display a quality bar only if we have some way
+ to actually evaluate the quality of the passphrase. */
+#define SHOW_QUALITYBAR (opt.min_passphrase_len \
+ && (opt.check_passphrase_pattern \
+ || opt.passphrase_quality_checker))
+
/* The assuan context of the current pinentry. */
static assuan_context_t entry_ctx;
@@ -1062,10 +1068,7 @@ agent_askpin (ctrl_t ctrl,
if (rc)
return unlock_pinentry (ctrl, rc);
- /* If a passphrase quality indicator has been requested and a
- minimum passphrase length has not been disabled, send the command
- to the pinentry. */
- if (pininfo->with_qualitybar && opt.min_passphrase_len )
+ if (pininfo->with_qualitybar && SHOW_QUALITYBAR)
{
rc = setup_qualitybar (ctrl);
if (rc)
@@ -1272,7 +1275,7 @@ agent_get_passphrase (ctrl_t ctrl,
if (rc)
return unlock_pinentry (ctrl, rc);
- if (with_qualitybar && opt.min_passphrase_len)
+ if (with_qualitybar && SHOW_QUALITYBAR)
{
rc = setup_qualitybar (ctrl);
if (rc)
--
2.14.1
More information about the Gnupg-devel
mailing list