aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--agent/command.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/agent/command.c b/agent/command.c
index 3ba921be4..715e70a94 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -2548,21 +2548,13 @@ option_handler (assuan_context_t ctx, const char *key, const char *value)
ctrl->server_local->allow_pinentry_notify = 1;
else if (!strcmp (key, "pinentry-mode"))
{
- if (!strcmp (value, "ask") || !strcmp (value, "default"))
- ctrl->pinentry_mode = PINENTRY_MODE_ASK;
- else if (!strcmp (value, "cancel"))
- ctrl->pinentry_mode = PINENTRY_MODE_CANCEL;
- else if (!strcmp (value, "error"))
- ctrl->pinentry_mode = PINENTRY_MODE_ERROR;
- else if (!strcmp (value, "loopback"))
- {
- if (opt.allow_loopback_pinentry)
- ctrl->pinentry_mode = PINENTRY_MODE_LOOPBACK;
- else
- err = gpg_error (GPG_ERR_NOT_SUPPORTED);
- }
- else
+ int tmp = parse_pinentry_mode (value);
+ if (tmp == -1)
err = gpg_error (GPG_ERR_INV_VALUE);
+ else if (tmp == PINENTRY_MODE_LOOPBACK && !opt.allow_loopback_pinentry)
+ err = gpg_error (GPG_ERR_NOT_SUPPORTED);
+ else
+ ctrl->pinentry_mode = tmp;
}
else if (!strcmp (key, "cache-ttl-opt-preset"))
{