mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-18 14:17:03 +01:00
Add option --no-ask for GET_PASSPHRASE.
This commit is contained in:
parent
c3e097f29f
commit
c3752d1057
@ -1,3 +1,7 @@
|
|||||||
|
2008-12-10 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* command.c (cmd_get_passphrase): Implement option --no-ask.
|
||||||
|
|
||||||
2008-12-09 Werner Koch <wk@g10code.com>
|
2008-12-09 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gpg-agent.c (main): Call i18n_init before init_common_subsystems.
|
* gpg-agent.c (main): Call i18n_init before init_common_subsystems.
|
||||||
|
@ -836,7 +836,7 @@ send_back_passphrase (assuan_context_t ctx, int via_data, const char *pw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* GET_PASSPHRASE [--data] [--check] <cache_id>
|
/* GET_PASSPHRASE [--data] [--check] [--no-ask] <cache_id>
|
||||||
[<error_message> <prompt> <description>]
|
[<error_message> <prompt> <description>]
|
||||||
|
|
||||||
This function is usually used to ask for a passphrase to be used
|
This function is usually used to ask for a passphrase to be used
|
||||||
@ -853,6 +853,10 @@ send_back_passphrase (assuan_context_t ctx, int via_data, const char *pw)
|
|||||||
If the option "--check" is used the passphrase constraints checks as
|
If the option "--check" is used the passphrase constraints checks as
|
||||||
implemented by gpg-agent are applied. A check is not done if the
|
implemented by gpg-agent are applied. A check is not done if the
|
||||||
passphrase has been found in the cache.
|
passphrase has been found in the cache.
|
||||||
|
|
||||||
|
If the option "--no-ask" is used and the passphrase is not in the
|
||||||
|
cache the user will not be asked to enter a passphrase but the error
|
||||||
|
code GPG_ERR_NO_DATA is returned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -865,10 +869,11 @@ cmd_get_passphrase (assuan_context_t ctx, char *line)
|
|||||||
char *cacheid = NULL, *desc = NULL, *prompt = NULL, *errtext = NULL;
|
char *cacheid = NULL, *desc = NULL, *prompt = NULL, *errtext = NULL;
|
||||||
char *p;
|
char *p;
|
||||||
void *cache_marker;
|
void *cache_marker;
|
||||||
int opt_data, opt_check;
|
int opt_data, opt_check, opt_no_ask;
|
||||||
|
|
||||||
opt_data = has_option (line, "--data");
|
opt_data = has_option (line, "--data");
|
||||||
opt_check = has_option (line, "--check");
|
opt_check = has_option (line, "--check");
|
||||||
|
opt_no_ask = has_option (line, "--no-ask");
|
||||||
line = skip_options (line);
|
line = skip_options (line);
|
||||||
|
|
||||||
cacheid = line;
|
cacheid = line;
|
||||||
@ -920,6 +925,8 @@ cmd_get_passphrase (assuan_context_t ctx, char *line)
|
|||||||
rc = send_back_passphrase (ctx, opt_data, pw);
|
rc = send_back_passphrase (ctx, opt_data, pw);
|
||||||
agent_unlock_cache_entry (&cache_marker);
|
agent_unlock_cache_entry (&cache_marker);
|
||||||
}
|
}
|
||||||
|
else if (opt_no_ask)
|
||||||
|
rc = gpg_error (GPG_ERR_NO_DATA);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Note, that we only need to replace the + characters and
|
/* Note, that we only need to replace the + characters and
|
||||||
|
@ -1036,7 +1036,7 @@ special handling of passphrases. This command uses a syntax which helps
|
|||||||
clients to use the agent with minimum effort.
|
clients to use the agent with minimum effort.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
GET_PASSPHRASE [--data] [--check] @var{cache_id} [@var{error_message} @var{prompt} @var{description}]
|
GET_PASSPHRASE [--data] [--check] [--no-ask] @var{cache_id} [@var{error_message} @var{prompt} @var{description}]
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@var{cache_id} is expected to be a string used to identify a cached
|
@var{cache_id} is expected to be a string used to identify a cached
|
||||||
@ -1067,6 +1067,11 @@ If the option @option{--check} is used, the standard passphrase
|
|||||||
constraints checks are applied. A check is not done if the passphrase
|
constraints checks are applied. A check is not done if the passphrase
|
||||||
has been found in the cache.
|
has been found in the cache.
|
||||||
|
|
||||||
|
If the option @option{--no-ask} is used and the passphrase is not in the
|
||||||
|
cache the user will not be asked to enter a passphrase but the error
|
||||||
|
code @code{GPG_ERR_NO_DATA} is returned.
|
||||||
|
|
||||||
|
|
||||||
@example
|
@example
|
||||||
CLEAR_PASSPHRASE @var{cache_id}
|
CLEAR_PASSPHRASE @var{cache_id}
|
||||||
@end example
|
@end example
|
||||||
|
Loading…
x
Reference in New Issue
Block a user