From 0706511b6d10561e97381554e404a960538ee342 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sun, 27 Feb 2011 08:35:16 -0500 Subject: [PATCH] Added CLEAR_PASSPHRASE option --agent to search the cache for a cacheid with a mode of CACHE_MODE_NORMAL. These cache modes are created with PKDECRYPT. --- agent/command.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/agent/command.c b/agent/command.c index 330c85182..63f59d408 100644 --- a/agent/command.c +++ b/agent/command.c @@ -1267,15 +1267,21 @@ cmd_get_passphrase (assuan_context_t ctx, char *line) static const char hlp_clear_passphrase[] = - "CLEAR_PASSPHRASE \n" + "CLEAR_PASSPHRASE [--agent] \n" "\n" "may be used to invalidate the cache entry for a passphrase. The\n" - "function returns with OK even when there is no cached passphrase."; + "function returns with OK even when there is no cached passphrase.\n" + "The --agent option is used to clear an entry for a cacheid added by\n" + "the agent.\n"; static gpg_error_t cmd_clear_passphrase (assuan_context_t ctx, char *line) { char *cacheid = NULL; char *p; + int opt_agent; + + opt_agent = has_option (line, "--agent"); + line = skip_options (line); /* parse the stuff */ for (p=line; *p == ' '; p++) @@ -1287,7 +1293,8 @@ cmd_clear_passphrase (assuan_context_t ctx, char *line) if (!cacheid || !*cacheid || strlen (cacheid) > 50) return set_error (GPG_ERR_ASS_PARAMETER, "invalid length of cacheID"); - agent_put_cache (cacheid, CACHE_MODE_USER, NULL, 0); + agent_put_cache (cacheid, opt_agent ? CACHE_MODE_NORMAL : CACHE_MODE_USER, + NULL, 0); return 0; }