summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2019-05-28 04:29:25 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2019-05-28 04:29:25 +0200
commit19415a265253a5ab72e79493d2f40c7e4441d81e (patch)
treed7652cd03f2e7deab515e55cba191f89fb65bbfc /agent
parentsm: Avoid confusing diagnostic for the default key. (diff)
downloadgnupg2-19415a265253a5ab72e79493d2f40c7e4441d81e.tar.xz
gnupg2-19415a265253a5ab72e79493d2f40c7e4441d81e.zip
agent: Remove unused agent_show_message.
* agent/call-pinentry.c (agent_show_message): Remove. * agent/genkey.c (take_this_one_anyway): Rename from take_this_one_anyway2. Remove a dead path calling agent_show_message. (check_passphrase_constraints): Use take_this_one_anyway. -- Fixes-commit: 2778c6f8f40d73272075ce04c07097f65c94054e Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'agent')
-rw-r--r--agent/call-pinentry.c49
-rw-r--r--agent/genkey.c29
2 files changed, 6 insertions, 72 deletions
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index 5b4713f41..487b21e81 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -1454,55 +1454,6 @@ agent_get_confirmation (ctrl_t ctrl,
-/* Pop up the PINentry, display the text DESC and a button with the
- text OK_BTN (which may be NULL to use the default of "OK") and wait
- for the user to hit this button. The return value is not
- relevant. */
-int
-agent_show_message (ctrl_t ctrl, const char *desc, const char *ok_btn)
-{
- int rc;
- char line[ASSUAN_LINELENGTH];
-
- if (ctrl->pinentry_mode != PINENTRY_MODE_ASK)
- return gpg_error (GPG_ERR_CANCELED);
-
- rc = start_pinentry (ctrl);
- if (rc)
- return rc;
-
- if (desc)
- build_cmd_setdesc (line, DIM(line), desc);
- else
- snprintf (line, DIM(line), "RESET");
- rc = assuan_transact (entry_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
- /* Most pinentries out in the wild return the old Assuan error code
- for canceled which gets translated to an assuan Cancel error and
- not to the code for a user cancel. Fix this here. */
- if (rc && gpg_err_source (rc) && gpg_err_code (rc) == GPG_ERR_ASS_CANCELED)
- rc = gpg_err_make (gpg_err_source (rc), GPG_ERR_CANCELED);
-
- if (rc)
- return unlock_pinentry (ctrl, rc);
-
- if (ok_btn)
- {
- snprintf (line, DIM(line), "SETOK %s", ok_btn);
- rc = assuan_transact (entry_ctx, line, NULL, NULL, NULL,
- NULL, NULL, NULL);
- if (rc)
- return unlock_pinentry (ctrl, rc);
- }
-
- rc = assuan_transact (entry_ctx, "CONFIRM --one-button", NULL, NULL, NULL,
- NULL, NULL, NULL);
- if (rc && gpg_err_source (rc) && gpg_err_code (rc) == GPG_ERR_ASS_CANCELED)
- rc = gpg_err_make (gpg_err_source (rc), GPG_ERR_CANCELED);
-
- return unlock_pinentry (ctrl, rc);
-}
-
-
/* The thread running the popup message. */
static void *
popup_message_thread (void *arg)
diff --git a/agent/genkey.c b/agent/genkey.c
index 46a772eda..0d2038016 100644
--- a/agent/genkey.c
+++ b/agent/genkey.c
@@ -148,27 +148,10 @@ check_passphrase_pattern (ctrl_t ctrl, const char *pw)
static int
-take_this_one_anyway2 (ctrl_t ctrl, const char *desc, const char *anyway_btn)
+take_this_one_anyway (ctrl_t ctrl, const char *desc, const char *anyway_btn)
{
- gpg_error_t err;
-
- if (opt.enforce_passphrase_constraints)
- {
- err = agent_show_message (ctrl, desc, L_("Enter new passphrase"));
- if (!err)
- err = gpg_error (GPG_ERR_CANCELED);
- }
- else
- err = agent_get_confirmation (ctrl, desc,
- anyway_btn, L_("Enter new passphrase"), 0);
- return err;
-}
-
-
-static int
-take_this_one_anyway (ctrl_t ctrl, const char *desc)
-{
- return take_this_one_anyway2 (ctrl, desc, L_("Take this one anyway"));
+ return agent_get_confirmation (ctrl, desc,
+ anyway_btn, L_("Enter new passphrase"), 0);
}
@@ -211,8 +194,8 @@ check_passphrase_constraints (ctrl_t ctrl, const char *pw,
if (opt.enforce_passphrase_constraints)
*failed_constraint = xstrdup (desc);
else
- err = take_this_one_anyway2 (ctrl, desc,
- L_("Yes, protection is not needed"));
+ err = take_this_one_anyway (ctrl, desc,
+ L_("Yes, protection is not needed"));
}
goto leave;
@@ -310,7 +293,7 @@ check_passphrase_constraints (ctrl_t ctrl, const char *pw,
*failed_constraint = msg;
else
{
- err = take_this_one_anyway (ctrl, msg);
+ err = take_this_one_anyway (ctrl, msg, L_("Take this one anyway"));
xfree (msg);
}
}